It then goes on to put the values into a hash called %FORM: $FORM{$name} = $value;
However, when I attempt to access the keys of %FORM, for example, $FORM{'name'} or $FORM{'email'}....my CGI Script erases the keys from the script, in these cases, $FORM{'name'} or $FORM{'email'} then it gives me an error message. Does anyone know why this is happening and is there a better way to transfer data from a HTML Form into a CGI Script that you can share with me.
Thanks,
Do the values you use to index into the FORM has exactly match the names of the input fields on the HTML form? You could do some debugging by printing out the entire hash - for example:
while ( ($k,$v) = each %FORM ) {
print "$k => $v\n";
}
This would tell you what was actually stored in it. Ideally, the keys ($k above) should be the HTML input field names, and the values ($v above) should be the user-entered data for each input field.
Simon
if ( $myHash{test} ) { # key test has just been created!
$myHash{test} = ""; # key "test" still exisit
}
undef($myHash{test}); # key "test" still exists
if ( exists $myHash{test} ) {
print "omg its true the key is still there ...";
}
delete($myHash{test}); # finaly its gone ...
if ( exists $myHash{test} ) {
print "#*$!?! ...";
} else {
print "finaly ... its gone";
}
I belive you do not get the value at all. ( typo in hash key etc ... ) You are creating the "key" with a test or something like that (eg: print $myHash{'test'} )some where on the fly.
watch fot typos like these:
<input type="text" name="Email">
.
.
.
.
email_send_function( $myHash{'email'}, $myHash{'text'});
$myHash{'email'} exsists now! but with "undef" as value.