Click to See Complete Forum and Search --> : Similsr mail() problem


gizmo
09-10-2003, 01:52 PM
This is simiar to another thread, however, for my first php program I am using a form starting with
<FORM action="feedback.php" method="post" enctype="text/plain">
and a typical line as
<TEXTAREA class="forms" name="address" cols="60" rows="4" wrap="virtual"> Enter your address here: </TEXTAREA>
There is a PHP file called, imaginatively, feedback.php which contains for example a line
$address=trim($address); which gives an error 'variable not defined'
and later another line
$mailcontent = "Address: ".$address."\n"
along with other similar things. Finally the line
mail($toaddress, $subject, $mailcontent, $fromaddress);
Now when the submit button is clicked the form is e-mailed ok and the php text 'Address: ' is sent ok but none of the variables have any content. What have I overlooked ?

Kr|Z
09-10-2003, 02:06 PM
If Register Globals is set to off, you have to use $_POST["address"] instead of $address.

gizmo
09-10-2003, 02:09 PM
So without having to trawl through lots of tutorials, how do I set register globals on, please ?

pyro
09-10-2003, 03:19 PM
It is not recommended to use global variables, but if your server is running PHP as an Apache module, you should be able to change global variables to be on with an .htaccess file. See http://us2.php.net/configuration.changes for more information. Basically, you are going to want to add a line that looks like this to your .htaccess file:

php_value register_globals 1

Why shouldn't you use registered globals? http://us4.php.net/security.registerglobals