I am trying to use numbers passed from a form element to a script and use it to open a file for writing where the numbers passed are part of the file name.
<input type=hidden name=event value=123456>I successfully pass the data to the script and can display it on the webpage, but everything goes wrong when I try to use it to open (create) a file for writing. Here is most all the code:
#!/usr/bin/perl -wT use CGI qw/:standard/; my $event = param('event'); my $commentUID = time(); my $newCOMMENT = param('newCOMMENT'); if ($newCOMMENT ne "") { open(AFH, ">> $event.txt"); print AFH "$commentUID\n"; close(AFH); open(BFH, ">> $commentUID.txt"); print BFH "$newCOMMENT\n"; close(BFH); }
The $commentUID.txt file is opened and written to just fine, but the form data passed to the script does not work at all. The most I could figure out is that the "." is being left out and 123456txt is trying to be opened...but all I get is an internal error. I have looked for a solution for several hours and cannot figure out how to do it. Please help.
In reply to open file using variable passed by form by michael.kitchen
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |