Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Script not working

Status
Not open for further replies.
Jun 30, 2003
196
GB
I am trying to put the details from a form into a file called perdat.dat

The script below is trying to accomplish this but it does not work

Any suggestions welcome

#!/usr/local/bin/perl -w

use CGI ":standard";

sub error {
print &quot;Error - file could not be opened < br/>;
print end_html();
exit(1);
}

my($name, $age, $gender, $email) = (param(&quot;name&quot;), param(&quot;age&quot;), param(&quot;gender&quot;), param(&quot;email&quot;));

print header();

$LOCK = 2;
$UNLOCK = 8;


open(PERDAT, &quot;>>perdat.dat&quot;) or error();
flock(PERDAT, $LOCK);

print PERDAT &quot;$name\:$age\:$gender\:$email\n&quot;;



flock(PERDAT, $UNLOCK);
close(PERDAT);

print start_html(&quot;Thankyou&quot;),
print &quot;thanks for participATING <br />\n&quot;;
print end_html();
 
Can you further define 'Does not work'? Do you get an error? Does it die silently? Are you not getting the results in the file that you expect?

 
yeah it does not save anything to the file.

I get an error message on the browser along the lines of &quot;ERROR&quot; sorry i know its not much help
 
the error message said the following

The server encountered an internal error or misconfiguration and was unable to complete your request.

 
What does the error log say? What goes to browser does not give any real details.
 
print &quot;Error - file could not be opened < br/>&quot;;

Missing quotes

perl -c filename.pl will give you a syntax check

HTH
--Paul
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top