
ad65
Deleted
May 14, 2001, 7:27 AM
Post #1 of 3
(1584 views)
|
Creating a html page from form input
|
Can't Post
|
|
I need to be able to create a html page from what someone types in a form field. The part: open (ALPHA, ">$FORM{name}.html") doesn't seem to work, if i put open (ALPHA, ">newname.html") it creates a html page called newname.html, but i want it to create the name from the form input. Is there any way to do this? # The following accepts the data from the form if ($ENV{'REQUEST_METHOD'} eq 'POST') { read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); @pairs = split(/&/, $buffer); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $FORM{$name} = $value; } # The following creates the file open (ALPHA, ">$FORM{name}.html") || die "Error creating file. $!\n"; print ALPHA "Name: $FORM{name}\n"; print ALPHA "By: $FORM{user}\n"; print ALPHA "Cheat: $FORM{cheats}\n"; &thank_you; }
|