dgwilliams
MIS
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 "Error - file could not be opened < br/>;
print end_html();
exit(1);
}
my($name, $age, $gender, $email) = (param("name", param("age", param("gender", param("email");
print header();
$LOCK = 2;
$UNLOCK = 8;
open(PERDAT, ">>perdat.dat" or error();
flock(PERDAT, $LOCK);
print PERDAT "$name\:$age\:$gender\:$email\n";
flock(PERDAT, $UNLOCK);
close(PERDAT);
print start_html("Thankyou",
print "thanks for participATING <br />\n";
print end_html();
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 "Error - file could not be opened < br/>;
print end_html();
exit(1);
}
my($name, $age, $gender, $email) = (param("name", param("age", param("gender", param("email");
print header();
$LOCK = 2;
$UNLOCK = 8;
open(PERDAT, ">>perdat.dat" or error();
flock(PERDAT, $LOCK);
print PERDAT "$name\:$age\:$gender\:$email\n";
flock(PERDAT, $UNLOCK);
close(PERDAT);
print start_html("Thankyou",
print "thanks for participATING <br />\n";
print end_html();