Gossamer Forum
Home : General : Perl Programming :

Please Help With CGI

Quote Reply
Please Help With CGI
Hello,
I have been working on changing the way my form displays the text when it is submitted using tables. I'm not very familiar with CGI and not quite sure where I went wrong. Any assistance will be greatly appreciated.

Thank you Smile
Hope

SCRIPT EXCERPT:

# Open Link File to Output
open (GUEST,">$guestbookreal") | | die "Can't Open $guestbookreal: $!\n";

for ($i=0;$i<=$SIZE;$i++) {
$_=$LINES[$i];
if (/<!--begin-->/) {

if ($entry_order eq '1') {
print GUEST "<!--begin-->\n";
}

if ($line_breaks == 1) {
print GUEST "<CENTER><TABLE CELLPADDING=2 ALIGN=Center WIDTH=75%><TR>/n";
print GUEST "<TD><FONT size=\"2\" face=\"arial, helvetica\">$FORM{'description'} =~ s/\cM\n/<br>\n/g;
}
(LINE 102)
print GUEST "<b>$FORM{'title'}</b><br>\n";

if ($FORM{'url'}) {
print GUEST "<a href=\"$FORM{'url'}\">$FORM{'url'}</a><BR>";
}
else {
print GUEST "$FORM{'url'}<BR>";
}

if ( $FORM{'username'} ){
if ($linkmail eq '1') {
print GUEST " <a href=\"mailto:$FORM{'username'}\">";
print GUEST "$FORM{'username'}</a><BR>";
}
else {
print GUEST " $FORM{'username'}<BR>";
}
}

print GUEST "\n";

if ( $FORM{'awarded'} ){
print GUEST "$FORM{'awarded'}<BR>";
}

if ( $FORM{'description'} ){
print GUEST " $FORM{'description'}<BR>";
}

if ( $FORM{'country'} ){
print GUEST " $FORM{'country'}<BR>";
}

if ($separator eq '1') {
print GUEST " - $date<BR>\n\n";
}
else {
print GUEST " - $date<BR></FONT></TD></TR></TABLE></CENTER>\n\n";
}

if ($entry_order eq '0') {
print GUEST "<!--begin-->\n";
}

ERROR LOG:
syntax error at /usr/www/xxx/httpd/cgi-bin/awarded.pl line 102, near "b>"
syntax error at /usr/www/xxx/httpd/cgi-bin/awarded.pl line 102, near "br>"
String found where operator expected at /usr/www/xxx/httpd/cgi-bin/awarded.pl line 105, near "print GUEST ""
(Might be a runaway multi-line "" string starting on line 102)
(Missing semicolon on previous line?)
Scalar found where operator expected at /usr/www/xxx/httpd/cgi-bin/awarded.pl line 105, at end of line
(Missing operator before ?)
syntax error at /usr/www/xxx/httpd/cgi-bin/awarded.pl line 105, near "<a href=\"$FORM{'url'}\">$FORM"
syntax error at /usr/www/xxx/httpd/cgi-bin/awarded.pl line 105, near "BR>"
Scalar found where operator expected at /usr/www/xxx/httpd/cgi-bin/awarded.pl line 108, at end of line
(Might be a runaway multi-line "" string starting on line 105)
(Missing operator before ?)
Quote Reply
Re: Please Help With CGI In reply to
Howya,

Just above 102 you have this line:

Code:
print GUEST "<TD><FONT size=\"2\" face=\"arial, helvetica\">$FORM{'description'} =~ s/\cM\n/<br>\n/g;

You'll have to do the regexp before you open the print statement, and you didn't close it off.

Cheers,
adam
Quote Reply
Re: Please Help With CGI In reply to
Hello Adam,
Thank you for your reply. I really appreciate it. Could you show me an example of how it should look? When it comes to cgi, I only know the basics thus far.

<<You'll have to do the regexp before you open the print statement, and you didn't close it off.>>

Thanks Again Smile
hope
Quote Reply
Re: Please Help With CGI In reply to
 
Code:
$description = "$FORM{'description'}"
$description =~ s/\cM\n/<br>\n/g;
print GUEST "<TD><FONT size=\"2\" face=\"arial, helvetica\">$description";

However I could be wrong. Somebody else may be able to point out my glaring errors, if there are any. Smile

Cheers,
adam

(Oops, went a bit wild with the pasting!)

[This message has been edited by dahamsta (edited April 22, 1999).]
Quote Reply
Re: Please Help With CGI In reply to
Thanks for the info. I'll give it a try. I've tried just about everything else I can think of. But that isn't saying much since I'm just about clueless when it comes to CGI...

Thanks Alot! Smile
hope

http://www.web-source.net