[thelist] CGI submission to print

Keith cache at dowebscentral.com
Sat Jun 29 18:48:01 CDT 2002


At 08:51 AM Saturday 6/29/2002, Jeff wrote:
>Can someone help me get this script to print new submissions
>to the index page?
>http://www.sonvenezuela.com/tour/

It would help if you tell us what is happening when you run the script,
Jeff. Off hand, without running the script, I think your main problem may
be in the lines


>my $text = "$phrase\n<li><b><a href="."$siteurl".">"."$sitename"."</a></b> -
>"."$sitedesc"."</li>\n";

You're quoting the variables, which do not need quoting when concatenated.
Try getting out of the quote problem with

my $text = qq~$phrase\n<li><b><a href="$siteurl">$sitename</a></b> -
$sitedesc</li>\n~;

Other than that the script is quite syntactically bloated. Example:

>while (<FILEIN>)
>{
>      push (@thefile, $_);
>}

can be accomplished with the one liner:

@thefile=<FILEIN>;

The redirect uses a javascript statement which is *really* uncalled for

>  # Direct users back to the URL
>  print "Content-type: text/html\n\n";
>  print ("<script language=\"JavaScript\">");
>  print ("window.location=\"http://www.sonvenezuela.com/tour\"\n\n");
>  print ("</script>");

Instead do a real redirect from the server (do not send a Content-type header)

$url = "http://www.sonvenezuela.com/tour";
print "Location: $url\n\n";

If that doesn't help let me know (offlist) what is, or is not, happening
when you run it.

One more thing, if you are on a Unix server, be SURE that the file you are
trying to write to has adequate permissions for writing to, probably 0666.

Cheers


Keith
====================
cache at dowebscentral.com




More information about the thelist mailing list