Posts: 3,987
Name: Abel Mohler
Location: Asheville, North Carolina USA
|
That's ok, you are asking a very normal and logical question.
The first thing you will do is to target the form at the page containing the code that will send the mail. The first thing this code will do is check for the existance of the "submit" variable, which should be contained inside of the $_POST array, assuming you have created your form like this:
HTML Code:
<form target="somescript.php" method="post">
<input name="from" type="text">
<input name="to" type="text">
<input name="subject" type="text">
<input name="body" type="text">
<input name="submit" type="submit" value="Send!">
The values stored inside of the $_POST array are referenced by the "name" attribute in each input. Thus, to check for the existance of the "submit" button, you do something like this:
PHP Code:
<?php if(isset($_POST['submit'])) {
} ?>
Inside of this IF statement, you will collect the values from the form like this:
PHP Code:
<?php if(isset($_POST['submit'])) { $from = $_POST['from']; $to = $_POST['to']; $subject = $_POST['subject']; $body = $_POST['body']; } ?>
Now you have the values stored conveniently inside of logically named variables, which can be used to plug in to the mail() function.
Hope that gives you something to sink your teeth into! 
__________________
I build web things. I work for the startup Please login or register to view this content. Registration is FREE
.
|