PHP and HTML form mismatch, please can you help.
Hi, I am trying to get a form on an HTML page to work with PHP for the first time but am going wrong somewhere.
Think it may be an issue with the ID's but am not completely sure.
Am expecting a return of Name, Email address. Telehone number and Postcode.
I would appreciate any help.
Thanks in advance for any help.
HTML
PHP
Hi, I am trying to get a form on an HTML page to work with PHP for the first time but am going wrong somewhere.
Think it may be an issue with the ID's but am not completely sure.
Am expecting a return of Name, Email address. Telehone number and Postcode.
I would appreciate any help.
Thanks in advance for any help.
HTML
Code:
<form class="form" id="form1"> <p class="name"> <input name="name" type="text" class="validate[required,custom[onlyLetter],length[0,50]] text-input" id="name" /> <label for="name">Name</label> </p> <p class="email"> <input name="email" type="text" class="validate[required,custom[email]] text-input" id="email" /> <label for="email">E-mail</label> </p> <p class="web"> <input name="web" type="text" id="web" /> <label for="web">Telephone</label> </p> <p class="text"> <input name="text" type="text" id="text" /> <label for="text">Postcode</label> </p> <p class="submit"> <input type="submit" value="Send" /> </p> </form>
Code:
<?php $name = $_POST['name']; // contain name of person $email = $_POST['email']; // Email address of sender $web = $_POST['web']; // Your website URL $body = $_POST['text']; // Your message $receiver = "[email protected]" ; // hardcorde your email address here - This is the email address that all your feedbacks will be sent to if (!empty($name) & !empty($email) && !empty($body)) { $body = "Name:{$name}\n\nE-mail:{$email}\n\nTelephone:{$web}\n\nPostcode:{$body}"; $send = mail($receiver, 'Contact Form Submission', $body, "From: {$email}"); if ($send) { echo 'true'; //if everything is ok,always return true , else ajax submission won't work } } ?>
Comment