I'm new to PHP and I'm trying to create a very simple php email form. How do I get it so that the page does not reload to a blank white page with just a text thank you message?
Link: http://www.katieful.com/contact2.html
HTML Form:
And here's my mail.php:
Thanks!
Link: http://www.katieful.com/contact2.html
HTML Form:
HTML:
<form method="POST" name="form" onsubmit="return validate(this)" action="mail.php" accept-charset="utf-8">
<div>
<label for="name">Name</label>
<input type="text" name="name" id="name" value="" maxlength="25" />
</div>
<div>
<label for="org">Organization</label>
<input type="text" name="org" id="org" value="" />
</div>
<div>
<label for="email">Email</label>
<input type="text" name="email" id="email" value="" />
</div>
<div style="height: 154px;">
<label for="message">Is there anything else you want to say?</label>
<textarea id="message" name="message" cols="5" rows="2"></textarea>
</div>
<input type="submit" class="submit" value="Submit!" style="width: 96px; float:left; margin-top: 8px;" onmouseover="this.className='submithover'" onmouseout="this.className='submit'" />
</form>
And here's my mail.php:
Code:
<?php
$name = $_POST['name'];
$email = $_POST['email'];
$org = $_POST['org'];
$message = $_POST['message'];
$formcontent="Hello Katie! You just got an email from Katieful! Happy new client dance! \n\nFrom:$name \nEmail: $email \nOrganization: $org \nMessage: $message";
$recipient = "[email protected]";
$subject = "Katieful Message from $email";
$mailheader = "From: $email rn";
mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
echo "";
?>
Thanks!