Contact form help please

this is my form lay out


				  	<h2 class="style">Contact Us</h2>
					       <form method="post" action="contact_us.php">
					    	<div>
						    	<span><label>NAME</label></span>
						    	<span><input name="userName" type="text" class="textbox"></span>
						    </div>
						    <div>
						    	<span><label>E-MAIL</label></span>
						    	<span><input name="userEmail" type="text" class="textbox"></span>
						    </div>
						    <div>
						    	<span><label>SUBJECT</label></span>
						    	<span><textarea name="userMsg"> </textarea></span>
						    </div>
						   <div>
						   		<span><input type="submit" value="Send Us"></span>
						  </div>
					    </form>

this is my php format have I set this up right also how do I get it to go back to the home page once they send there mail please ??

<?php 
$name = $_POST['userName'];
$email = $_POST['userEmail'];
$subject = $_POST['userMsg'];
$formcontent="From: $name \n message: $subject";
$recipient = "myemail@example.co.uk";
$subject = "Contact Form";
$mailheader = "From: $email \r\n";
mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
?>

This is a PHP question, not an HTML/CSS one. I have moved it for you.

Although after your mail function, send a header.

header('Location: http://www.sitehere.com/index.php');

thanks

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.