There are various contact form scripts and codes out there on php. I’m going to show you a very simple form which you can adapt according to your needs.
The form shows a contact form and once submitted it hides the contact form and shows the thank you message only.
A modified version of the form can be seen at: http://writeinurdu.comcontact page. Make sure you change these in the form atleast.
$to = "[email protected]"; $subject = "your email subject";
Rest will work by just uploading the form to your server.
<div id="contactpage"> <?php $contactform = ' <form id="contact" name="contact" method="post" action=""> <span>Full Name</span> <input type="text" name="fullname" id="fullname" value=""> <span>Email id</span> <input type="text" name="emailid" id="emailid" value=""> <span>Message</span> <textarea name="message" id="message"></textarea> <p><input type="submit" name="contactsubmit" id="contactsubmit" class="csubmit" value="Submit"/></p> </form> '; $contactthanks = ' <br><br><br><center><p>Thank you for your message. We will get back to you within 24 to 48 hours!</p><br>(don\'t forget to share our website to your friends!)<br><br></center><br> '; if($_POST['contactsubmit']){ $sender = $_POST['fullname']; $emailid = $_POST['emailid']; $message = $_POST['message']; $to = "[email protected]"; $subject = "your email subject"; $txt = $sender." \n \n ".$message; $headers = "From: $emailid" . "\r\n"; mail($to,$subject,$txt,$headers); echo $contactthanks; }else{ echo $contactform; } ?> </div>