Using ActivePerl with Apache web server on Windows ME operating system (home computer). I know, thats not the greatest situation but till I get linux thats what I am using. Am trying to write data out to a file that is input from a web page form thru GET and is passed into a %hash variable (%form_data) for parsing. Am able to print qq($name - $value <br><br>); and view the hash pairs on the web page as shown below. However, when I try to write them out to a file using: print GUESTBOOK $form_data{'name'} # for example (see below) nothing is actually written although the web page executes as shown below. Does anyone know if this is a problem with the Windows version of Perl or Apache or maybe I am doing something wrong AGAIN.
#----- Hash parse section shown below ---------------------- # Finally, we'll load the variables into an associative array # so we can use it when we need it. my %form_data; if($form_data{$name}) { $form_data{$name} .= "\t$value"; } else { $form_data{$name} = $value; } print qq($name = $value <br><br>); }
#------------------------------------------------- This is the web page output from above print qq statement plus other c +ode #-----------------------------------------------------------
name = me email = me@you.com city = boogerville location = XYZ web_url = www.me.you web_title = STUFFit comments = These are comments. Hi There. What'cha doin'? Your GuestBook Entry has been Submitted! Your guestbook entry has been successfully added to the guestbook. You + may need to click reload to view your guestbook entry.
#------------------------------------------------- # attempt to write data out to a file here. # doesn't work. nothing writes out. if($form_data{'email'}) { # if there's an email address, let's add it as a link print GUESTBOOK "<DD><I><B><A HREF=\"mailto:$form_data{'email +'}\"> $form_data{'name'}</A></B> - $form_data{'city'}, $form_data{'location'}</I>\n"; } else { # otherwise, just add their name print GUESTBOOK "<I><B>From:</B> $form_data{'name'}</I><BR>\n"; }
Edit kudra, 2002-08-31 Removed code tags around plaintext
# the above code does not put out any data to the file but it does run. Thanks, ljdennis@att.netIn reply to Hash Parsing Problem by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |