CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
Stupid Problem Saving

 



etheracide
journeyman

Jun 27, 2002, 3:00 AM

Post #1 of 2 (263 views)
Stupid Problem Saving Can't Post

There is a reason why I always post to the beginner's board and this is an example of why. For some reason, when this script is called up, it prints a blank page and does not save the info to the database.

The first script is a form which sends data to the script that is giving me the problem. The form action is: <form action="\secondscript.cgi?id\" method=POST>

The following lines are the script that the first one sends all of its info to. The second script is supposed to open the appropriate database, save the info to it, and then print up the HTML page with all the info that was sent to it. I am quite unsure why this won't work... but it just brings up a blank page and the status bar says simply "done".

________________________________________________________________-

#!/usr/bin/perl -T

#######################################################################
#
#
#
#########################################################################



## The URL to where this script is located
## No end backslash
my $folder = http://www.myserver.com/cgi-bin/scriptfolder/feedback;


## The name of the viewer program;

my $view = "thirdscript.cgi";


#############################

use CGI;
$christophersnyder = new CGI();


print "Content-type: text/html\n\n";

open(DATA, "<formtop.dat");
@formtop = <DATA>;
close(DATA);


open(DATA2, "<formbottom.dat");
@formbottom = <DATA2>;
close(DATA2);


# These next lines allows the URL to tell the script what it is supposed to do.


my $id = $ENV{"QUERY_STRING"};

$name = $christophersnyder->param('name');
$email = $christophersnyder->param('email');
$url = $christophersnyder->param('url');
$feedback = $christophersnyder->param('feedback');


open(LOG, ">>$folder/$id.dat");
print LOG "$name|$email|$url|$feedback\n";
close(LOG);


print "@formtop";
print "<table width=\"75%\">\n";
print "<tr><td colspan=2><span class=title>Thank you! Here is your feedback for <b>$id</b></span></td></tr>\n";
print "<tr><td><br /><span class=body>Your Name:</span></td><td><span class=body>$name</span></td></tr>\n";
print "<tr><td><span class=body>Your E-mail:</span></td><td><span class=body>$email</span></td></tr>\n";
print "<tr><td><span class=body>Your
URL:</span></td><td><span class=body>$url</span></td></tr>\n";
print "<tr><td><span class=body>Your Feedback:</span></td><td><span class=body>$feedback</span>\n";
print "<tr><td colspan=2><span class=body>Click <a href=\"$url/$view?$id\">here</a> to view all the feedback for <b>$id</b> including yours.\n";
print "<tr><td colspan=2><br /><form> <input type=\"button\" value=\"Close This Window\" onClick=\"window.close()\"></form></td></tr>\n";
print "</table>\n";



print "@formbottom";

exit;

____________________________________________________________

The formtop array holds the CSS info just to clear up the fact that I use span tags throughout the HTML.

All help is greatly appreciated.


davorg
Thaumaturge / Moderator

Jun 28, 2002, 12:49 AM

Post #2 of 2 (255 views)
Re: [etheracide] Stupid Problem Saving [In reply to] Can't Post

Do you get anything written to the server error log?

You don't check the return value from any of your "open" calls. It could be a file permissions problem.

--
Dave Cross, Perl Hacker, Trainer and Writer
http://www.dave.org.uk/
Get more help at Perl Monks

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives