Click to See Complete Forum and Search --> : textarea
Booooze
12-14-2003, 02:41 PM
Hi again.
i found somemore code, and this time, it take all of the info from a textarea, which is what i need. but, when i run it, it gives me an error 500 again, but the data still writes. what does that mean? any ideas, and also, how can i get it to start a new line? thx
#!C:\Perl\bin
use CGI;
use CGI::Carp qw[fatalsToBrowser];
my $q = new CGI;
my $record = $q->param('text_field');
open(OUTFILE, ">>output.txt") or die "Can't open output.txt: $!";
print OUTFILE $record;
close OUTFILE;
furious70
12-16-2003, 04:37 PM
so it writes everything you want to output.txt?
You aren't telling it anything to display after you do this. That should result in just a blank page being loaded, not an error however
Booooze, as furious70 has pointed out, the program is doing just as it is written; writing to a file. You have no other task and since you aren't printing any header information, the script will die 500 error.
new line would be like so:
print OUTFILE "$record\n";
or
print OUTFILE $record . "\n";
now, every new record will be appended as a new line
Booooze
12-16-2003, 06:31 PM
allrighty, the new line thing works, thats good, thank you for that guys, just one more thing, how can i make it go to a ceratin page when its succesful, and a different page when it fails, thank you
ray326
12-17-2003, 12:07 AM
You send a redirect header back to the browser. I think CGI.pm encapsulates that action so just search its docs for 'redirect'.
furious70
12-17-2003, 08:51 AM
from the cgi.pm doc:
print $query->redirect(-uri=>'http://somewhere.else/in/movie/land',
-nph=>1);
The -nph parameter, if set to a true value, will issue the correct headers to work with an NPH (no-parse-header) script. This is important to use with certain servers, such as Microsoft Internet Explorer, which expect all their scripts to be NPH.
Booooze
12-17-2003, 07:28 PM
thannks alot guys! this script is really important to my site, and now it works! thanks a bunch