Email Form
Create you're first very basic email form and handler.
Category: Coding
Views: 3051

Email Form Welcome, today you will learn how to create you're first very basic email form and handler.

First lets make the form, if you dont know how to create a form, look back on the form tutorial.

Code:


Name



Query





Now that we have got the form completed we can start on our handler.

Code:

if(isset($_POST['submit'])){//If the form was submitted
//do this
}
else{ //the form hasent been submitted so we show the form
echo '
Name



Query




'; //end the echo
} //end the else
?>
Thats the first basic thing done.
We have checked to see if the form was submitted and if it wasent it shows the form.
Now for the next piece.

Code:
if(isset($_POST['submit'])){//If the form was submitted
$name = $_POST['name']; //get the name
$query = $_POST['query']; //get the query
$output = '
Name: $name
Query: $query';
$mail = mail('youremail@yourdomain.com','subject',$output); //mail it
echo 'You're email has been sent! congrats, you've completed you're first email form.';
}
else{ //the form hasent been submitted so we show the form
echo '
Name



Query




'; //end the echo
} //end the else
?>

Congrats, you've made you're first email form handler.

If you would like more help with this tutorial please register and visit the forum.

About Michael

Michael Dunlop Michael Dunlop personal statement

“But I am already older than 21”, I hear you cry. Don’t worry, despite the name, the information and advice is more geared towards retiring prior to having a fake hip installed.

Website Sponsors
Recommended Websites
They Buy, Build, Upgrade and Sell Websites.
 
Advertise Here
Feature Interviews
Graham went from $100 one day to ... Read more
Paul Bourque started affiliate marketing less than ... Read more
Interview with Yaro Starak of Entrepreneurs-Journey.com is ... Read more
Recommended Resources
 
 
 
 
 
Get Retire at 21's FREE Secrets
Find out how I'm going to Retire VERY Early Subscribe for my Free Secrets Privacy Guaranteed. 100% Spam free.