Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Data from a Form to PHP 1

Status
Not open for further replies.

netmind

MIS
Oct 31, 2002
17
0
0
US
I'm having trouble passing input from a Form to PHP.
My Form is:
<FORM method=post action=&quot;xxx.php&quot;>
Your email address: <INPUT type=&quot;text&quot; name=&quot;email&quot;><br>
What's the subject: <INPUT TYPE=text NAME=&quot;thesubj&quot; value=&quot;type it in&quot;><br>

xxx.php is:
$to=&quot;aaa@aaa.bla&quot;;
$frommail=$email;
$info=&quot;Problems?&quot;;
mail ($to, $thesubj, $info, &quot;from:$frommail&quot;);

I do get the mail and $to and $info which are defined here, but I don't get $thesubj and who it's from. If I echo $thesubj and $email it's just blank.
Any help would be appreciated.
Thanks.
netmind
 
netmind,

Check out the settings for register globals - it's probably off (and that's good).
PHP has a toggle that translates posted variables into PHP variables of the same name - it is nowadays switched off because of security reasons.

To escape this setting use the superglobal array $_POST (PHP> 4.1.2):
Code:
$to=&quot;aaa@aaa.bla&quot;;
$frommail=$_POST['email'];
$info=&quot;Problems?&quot;;
mail ($to, $_POST['thesubj'}, $info, &quot;from:$frommail&quot;);
 
DRJ478
Thanks A Lot!
That worked perfect!

netmind
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top