Hi, Can anyone please give me guide on creating a lead form for a landing page? Say there will be three fields, Name, Phone and Email. If someone fill in the form then I will receive their details in my email. How can I do that?
That's a really simple contact form - use google, find and work through a few examples so that you can see a few different ways of working it.
Thanks CarpCharacin & Sarahk I really like foxyform but they use their brand in the form How can I hide that?
Here is the php code along the html form. Create a php file and copy/paste this code in file and execute to make sure everything works. <?php if(isset($_POST['submit'])){ $to ="email@example.com";// this is your Email address $from = $_POST['email'];// this is the sender's Email address $first_name = $_POST['first_name']; $last_name = $_POST['last_name']; $subject ="Form submission"; $subject2 ="Copy of your form submission"; $message = $first_name ." ". $last_name ." wrote the following:"."\n\n". $_POST['message']; $message2 ="Here is a copy of your message ". $first_name ."\n\n". $_POST['message']; $headers ="From:". $from; $headers2 ="From:". $to; mail($to,$subject,$message,$headers); mail($from,$subject2,$message2,$headers2);// sends a copy of the message to the sender echo "Mail Sent. Thank you ". $first_name .", we will contact you shortly.";// You can also use header('Location: thank_you.php'); to redirect to another page.}?> <!DOCTYPE html><head><title>Form submission</title></head><body> <form action="" method="post"> First Name: <inputtype="text"name="first_name"><br> Last Name: <inputtype="text"name="last_name"><br> Email: <inputtype="text"name="email"><br> Message:<br><textarearows="5"name="message"cols="30"></textarea><br><inputtype="submit"name="submit"value="Submit"></form> </body></html> PHP:
@CodeShop thanks a lot! I am not a coder but I can understand basic things. In your code I don't think there is any validation check for form fields. Can you please add validation check and captha integration as well within this code to avoid spam? My website pages are not php based. Pages are on HTML. Can you please rewrite the code and give me updated one? Thanks in advance!
You know how you can send a copy to the person filling out the form? Well, spammers do that and put spam in the message and put their email address as the person they really want the spam sent to. Next thing you know you are getting all this stuff for Russian florists (I kid you not) but what they're really doing is sending the spam to hundreds of other people via your site. Your site then gets the bad reputation.