Quote:
|
Originally Posted by GoldNetX
Now the way the php code section works is, when the user submits the form the server is going to grab the data in the fields and store that data temporarly on the server. So once it does you can then access the data on the server using the php variable $_POST. This variable is like an array where the keys are the name attributes of the form items.
So to access the data from the form you have, you would use:
$_POST['emailTo']
$_POST['name']
$_POST['address']
$_POST['city']
$_POST['state']
$_POST['age']
$_POST['comment']
So here is an example of how you could use these references to construct and email:
Code:
<?php
if ($_POST['emailSubmit']){
$body = "The following information was just submitted by a user: \n\n Full Name: " . $_POST['name'] . "\n Address: " . $_POST['address'] . "\n City: " . $_POST['city'] . "\n State: " . $_POST['state'] . "\n Age: " . $_POST['age'] . "\n Comment: " . $_POST['comment'];
mail($_POST['emailTo'], "Replace this with what you want the subject to be", $body);
}
?>
Then just replace the part about the subject with what you want the subject of your email to be and you should be set.
|
Would this go in the body of my page? like any specific order? can i test my sserver if i run php? which im sure i do but id like to just check. youve saved my day and your helping me learn thanks ;0) i greatly appreciate it