Insert this code providing you can run PHP, at the top of your PHP page in PHP tags. You will need to run your own validation, this is a very simple contact form and works well
PHP Code:
// Contact US Form PHP Code
// Carl Pickering - Line3 Internet Ltd
// Stops page from sending form when loaded
if($_POST['action']=='send') {
// define some variables first
$send_to = "uremail@domain.tld";
$subject = "Subject";
// Pop-Up Txt
$thank_you ="Thank you for enquiry, we will contact you back soon";
$c_person = $_POST['c_name'];
$c_email = $_POST['c_email'];
$c_phone = $_POST['c_phone'];
$c_message = $_POST['c_message'];
// Build the message
$message = "The following person has sent information from the website\n\n";
$message .= "Name: $c_person\n";
$message .= "Telephone: $c_phone\n";
$message .= "Email: $c_email\n";
$message .= "Message: $c_message \n";
$mailheaders = "From: $c_person <$c_email> \n";
$mailheaders .= "Reply-To: $c_person <$c_email>\n\n";
// Simple but basic.. Now send the email
mail($send_to, $subject, $message, $mailheaders);
print(" <script language=\"Javascript\"> alert('$thank_you'); </script> ");
}
Form Code:
HTML Code:
<form action="contact.php" method="post" enctype="multipart/form-data" name="contact_us" id="form">
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td height="23" style="padding:2px 0px 0px 0px;" align="right" width="100%">Your Name:</td>
<td><input name="c_name" type="text" class="input_2" id="c_name"></td>
</tr>
<tr>
<td height="23" style="padding:2px 0px 0px 0px;" align="right" width="100%">Your Phone:</td>
<td><input name="c_phone" type="text" class="input_2" id="c_phone"></td>
</tr>
<tr>
<td height="23" style="padding:2px 0px 0px 0px;" align="right">Your email: </td>
<td><input name="c_email" type="text" class="input_2" id="c_email"></td>
</tr>
<tr>
<td height="23" style="padding:2px 0px 0px 0px;" align="right" width="100%">Message:</td>
<td><textarea name="c_message" cols="3" rows="3" id="c_message"></textarea></td>
</tr>
<tr>
<td width="100%"><img src="images/spacer.gif" width="1" height="1" alt=""><input name="action" type="hidden" id="action" value="send"></td>
<td align="right" style="padding:5px 0px 0px 0px;"><img src="images/read_1.gif" alt="" style="margin:0px 5px 0px 0px;"><a href="javascript:document.contact_us.reset();">Reset</a><img src="images/read_1.gif" alt="" style="margin:0px 5px 0px 30px;"><a href="javascript:document.contact_us.submit();">Submit</a></td>
</tr>
</table>
</form>
Notice the hidden form element, the form will only be posted, if that variable is sent.
You may wanna use strip_tags on your code too, before posting, stops people injecting nasty code.... I do
HTH - Like i said, its dead basic, but gets you going