Simple PHP Form Mail Tutorial

Posted by Muhammad Shiraz Kamboh Tuesday, 12 June 2012 0 comments
Simple mail form
 
This tutorial will show you how to create a simple form mail that emails a specified email.
The Following Code is the actual form where the input can be typed.






CODE
<form method="post" action="mailME.php">
&nbsp;<table border="1" width="444" height="41" style="border-collapse: collapse" bordercolor="#000000">
<tr>
<td height="4" width="95">
<b>YourEmail:</b> </td>
<td height="4" width="342"> <input type="text" name="email" size="45"></td>
</tr>
<tr>
<td height="27" width="95">
<b>Subject:</b></td>
<td height="27" width="342"> <input type="text" name="subject" size="45"></td>
</tr>
<tr>
<td height="20" width="95"><b>Message:</b></td>
<td height="20" width="342">
<textarea name="comments" cols="20" rows="1"></TEXTAREA></td>
</tr>
</table>
<p>
<input type="submit" name="submit" value="Submit">
<input type="reset" name="reset" value="Reset"></p>
</form>
<p>&nbsp;</p>

As you can see above that just a simple html form, save this as contact.html

This is where the php begins
CODE

<?
// Replace with your email address!
$to = "YOUR_EMAIL@EMAILHOST.COM";

if($submit)
{
mail("$to", "$subject", "$email", "$message");

} else {
echo "There was an error please try again";
}
?>

Popular Posts

About Me

My photo
I create this Blog for learn the all kind of tutorial about web developing | HTML, Java, PHP, Graphic designing, Corel Draw, Photoshop, Micromedia Flash, Swish and many more related software and internet programming tutorials.

Followers

Blog Archive