Articles Comments

Simple php email form coding

SHARE: Share

If your site doesn’t have a contact form yet, you can use this one:

<?php
if ($_POST){
$to "your@email.address";
$subject "YOUR SUBJECT";
$email $_REQUEST["email"];
$name $_REQUEST["name"];
$message "Name: ".$name."\r\n""Email: ".$email."\r\n""Message:
"
.$_REQUEST["message"];
$headers "From: $email"mail($to$subject$message$headers);
echo 
"Thanks for submitting.";
}
else
{
?>

<html> <head>
<title>Contact Us</title>
<body>
<table>
<form action="" method="post">
- Hide quoted text -
<tr>
<td>
Your Name:
</td>
<td><input type="text" name="name"></td>
</tr>
<tr>
<td> Your Email: </td>
<td><input type="text" name="email"></td>
</tr>
<tr>
<td> Message: </td>
<td><textarea name="message"></textarea> </td>
</tr>
<tr><td colspan="2"><input type="submit" value="Send
your comments"> </td></tr>
</form>
</table>
</body>
</html>
<?php ?>

If you need help implementing it or you want to add new fields, contact me.

Written by

If you need someone to code/fix your site, contact me here.

Filed under: Web development · Tags: , ,

Leave a Reply