Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

comment on

( [id://3333] : superdoc . print w/replies, xml ) Need Help??
I'm having a problem, my friends site has had this error for months, I have no idea what is causing the problem, I know nothing about perl but I am ready to learn can anyone help me fix this problem, and another friend built this site, but he has not been able to help fix it any help would be greatly appreciated, he also refered me to this site. ----------------------------------------------------------- This is the error:
Software error: syntax error at line 13, near ") {" syntax error at line 42, near "}" Execution of aborted due to compilation errors.
And this is the page where the error is suppose to be occuring:
----------------------------------------------------------- #!/usr/bin/perl -w use lib './'; use CGI; use File::Basename; use CGI::Carp qw(fatalsToBrowser); use DBI; require './'; my $query=new CGI; print $query->header(); print $css_style; If $query->upload('fullimage_file') || $query->upload('thumbnail_file' +) { my $img_name = $query->param('item'); my $full_pic = $query->upload('fullimage_file'); my $thumb_pic = $query->upload('thumbnail_file'); my $fullname = basename($full_pic); my $thumbname = basename($thumb_pic); my ($F_name, $f_ext) = split /\./, $fullname,2; my ($T_name, $t_ext) = split /\./, $thumbname,2; my $short_name="$img_name\.$f_ext"; my $short_tname="$img_name\_t\.$t_ext"; my $new_name = "$doc_root$img_folder/$short_name"; my $new_tname = "$doc_root$img_folder/$short_tname"; if ($full_pic ne ''){ open (OUTFILE,">$new_name"); binmode OUTFILE; while ($bytesread=read($full_pic,$buffer,1024)) { print OUTFILE $buffer; } } if ($thumb_pic ne ''){ open (FILE,">$new_tname"); binmode FILE; while ($bytesread=read($thumb_pic,$buffer,1024)) { print FILE $buffer; } } } my $dbh = DBI->connect('DBI:mysql:*********', '*****', '*****' , { +RaiseError => 1 , AutoCommit => 1}) || die "Can't Connect: $!"; my $sth = $dbh->prepare("UPDATE inventory SET img=\"$short_name\", thu +mb=\"$short_tname\" WHERE partno=\"$img_name\";" ); $sth->execute; print "<body onload=\"''\" bgcolor='#3 +33366' text='#D5D5D5' leftmargin='0' topmargin='0'><table width='755' + border='0' cellpadding='0' cellspacing='4' bgcolor='#000000' align=' +center'><tr><td><table bgcolor='#575d92' cellspacing='0' border='0'>< +tr><td colspan='2' bgcolor='#000000'><img src='/img/top1.jpg'><br>$me +nu_code</td></tr><tr><td bgcolor=$page_color >"; print '<table width="95%" align="center" valign="top"><tr><td align=ce +nter bgcolor="#5F6490"><div ID="Tip1" Style="display:none;">Go to our + home page.</div><div ID="Tip2" Style="display:none;">View our Online + Catalog.</div><div ID="Tip3" Style="display:none;">Learn more about +the services we provide.</div><div ID="Tip4" Style="display:none;">Ou +r Research and Development page.</div><div ID="Tip5" Style="display:n +one;">Learn more about turbos.</div><div ID="Tip6" Style="display:non +e;">All about Turbo Boss.</div><div ID="Tip7" Style="display:none;">W +elcome to Turbo Boss.</div></td></tr><tr><td>'; print $query->start_multipart_form(); print $query->hidden(-name=>"item", -value=>"$img_name"); print 'This will replace any existing images for this product.<p>'; print '<p>Full Sized Image:<br>'; print $query->filefield('fullimage_file','',50,80); print '<p>Thumbnail Image:<br>'; print $query->filefield('thumbnail_file','',50,80); print '<p><center>', $query->submit(-name=>'', -value=>'Add Pics') . ' +</center>'; print '<p><center><a href="/">Back to add parts</a></td></tr +></table>'; print "<br><br></td></tr><tr bgcolor='#5F6490'><td><center><b>$admin_l +inks</b></center></td></tr></table><tr><td><img src='/img/bottom.jpg' + border='0'></td></tr></table>"; print $query->end_html;
Edited 2004-08-01 by Ovid

20040802 Edit by davido: Changed title from '379155 : What Is causing This'

In reply to Need help with syntax error in CGI script by apariah2

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.