vendredi 4 avril 2014

Trying to create a contact us form


Vote count:

0




The goal of this code is to have someone fill it out then it sends their typed message to my email. I've looked online for some references, and being so new to php I'm having a lot of trouble understanding why when I click the send button it shows my php pages code.



<form action="mail.php" method="POST">
<p>Name</p> <input type="text" name="name">
<p>Email</p> <input type="text" name="email">

<p>Priority</p>
<select name="priority" size="1">
<option value="Low">Low</option>
<option value="Normal">Normal</option>
<option value="High">High</option>
</select>
<br />

<p>Type</p>
<select name="type" size="1">
<option value="update">Question</option>
<option value="change">Information Change</option>
<option value="addition">Information Addition</option>
<option value="new">Misc.</option>
</select>
<br />

<p>Message</p><textarea name="message" rows="6" cols="25"></textarea><br />
<input type="submit" value="Send"><input type="reset" value="Clear">
</form>

<?php
$name = $_POST['name'];
$email = $_POST['email'];
$priority = $_POST['priority'];
$type = $_POST['type'];
$message = $_POST['message'];
$formcontent=" From: $name \n Priority: $priority \n Type: $type \n Message: $message";
$recipient = "dnasim09@gmail.com";
$subject = "Contact Form";
$mailheader = "From: $email \r\n";
mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
echo "Thank You!" . " -" . "<a href='form.html' style='text- decoration:none;color:#ff0099;'> Return Home</a>";
?>


All help is appreciated. Thanks!



asked 36 secs ago






Aucun commentaire:

Enregistrer un commentaire