SebbieHE Posted January 29, 2013 Share Posted January 29, 2013 <form action="#" id="ContactForm"> <div class="success"> Contact form submitted! I will be in touch soon.</div> <fieldset class="left"> <div class="block"> <label class="name padRight3"> <span class="title1">Name:</span> <span class="bg"><input type="text" value="" class="input"></span> <span class="error">*This is not a valid name.</span> <span class="empty">*This field is required.</span> </label> <label class="email"> <span class="title1">Email:</span> <span class="bg"><input type="email" value="" class="input"></span> <span class="error">*This is not a valid email address.</span> <span class="empty">*This field is required.</span></label> <label class="phone"> <span class="title1">Phone:</span> <span class="bg"><input type="tel" value="" class="input"></span> <span class="error">*This is not a valid number.</span> <span class="empty">*This field is required.</span> </label> </div> <div class="block"> <label class="message"> <span class="title1">Message:</span> <span class="bg"><textarea rows="1" cols="2"></textarea></span> <span class="error">*The message is too short.</span> <span class="empty">*This field is required.</span> </label> </div> <div class="formButtons"> <div class="formBtn"> <a href="#" data-type="submit" class="moreButton">Send</a> </div> <div class="formBtn"> <a href="#" data-type="reset" class="moreButton">Clear</a> </div> </div> </fieldset> </form> Quote Link to comment Share on other sites More sharing options...
thara Posted January 29, 2013 Share Posted January 29, 2013 I think, you have forgotten to ask your question here. Quote Link to comment Share on other sites More sharing options...
SebbieHE Posted January 29, 2013 Author Share Posted January 29, 2013 Sorry 'Please could someone help me make the PHP script so that contact form sends the info typed in to my email address?'. Quote Link to comment Share on other sites More sharing options...
thara Posted January 29, 2013 Share Posted January 29, 2013 have you tried something with PHP? If not I am sure anyone won't help you regarding this. Quote Link to comment Share on other sites More sharing options...
SebbieHE Posted January 29, 2013 Author Share Posted January 29, 2013 What do you mean? I've done contact forms before but, this one is harder. Quote Link to comment Share on other sites More sharing options...
Jessica Posted January 29, 2013 Share Posted January 29, 2013 How is it harder? Where is your PHP code? We don't write the code for you. Quote Link to comment Share on other sites More sharing options...
SebbieHE Posted January 29, 2013 Author Share Posted January 29, 2013 LOL. My baad sorry. Forgot to put the php aswell. soory Quote Link to comment Share on other sites More sharing options...
thara Posted January 29, 2013 Share Posted January 29, 2013 If you come back with your PHP code, You will welcome by this forum Quote Link to comment Share on other sites More sharing options...
SebbieHE Posted January 29, 2013 Author Share Posted January 29, 2013 Okay sorry for late reply, lost the php so had to make it again. Will this php work with the HTML? <?php if(isset($_POST['email'])) { $email_to = "you@yourdomain.com"; $email_subject = "Query"; function died($error) { echo "We are very sorry, but there were error(s) found with the form you submitted. "; echo "These errors appear below.<br /><br />"; echo $error."<br /><br />"; echo "Please go back and fix these errors.<br /><br />"; die(); } if(!isset($_POST['name']) || !isset($_POST['email']) || !isset($_POST['phone']) || !isset($_POST['message'])) { died('We are sorry, but there appears to be a problem with the form you submitted.'); } $first_name = $_POST['name']; // required $last_name = $_POST['email']; // required $email_from = $_POST['phone']; // required $comments = $_POST['message']; // required $error_message = ""; $email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/'; if(!preg_match($email_exp,$email_from)) { $error_message .= 'The Email Address you entered does not appear to be valid.<br />'; } $string_exp = "/^[A-Za-z .'-]+$/"; if(!preg_match($string_exp,$first_name)) { $error_message .= 'The First Name you entered does not appear to be valid.<br />'; } if(!preg_match($string_exp,$last_name)) { $error_message .= 'The Last Name you entered does not appear to be valid.<br />'; } if(strlen($comments) < 2) { $error_message .= 'The Comments you entered do not appear to be valid.<br />'; } if(strlen($error_message) > 0) { died($error_message); } $email_message = "Form details below.\n\n"; function clean_string($string) { $bad = array("content-type","bcc:","to:","cc:","href"); return str_replace($bad,"",$string); } $email_message .= "Name: ".clean_string($name)."\n"; $email_message .= "Email: ".clean_string($email)."\n"; $email_message .= "Phone: ".clean_string($phone)."\n"; $email_message .= "Message: ".clean_string($message)."\n"; $headers = 'From: '.$email_from."\r\n". 'Reply-To: '.$email_from."\r\n" . 'X-Mailer: PHP/' . phpversion(); @mail($email_to, $email_subject, $email_message, $headers); ?> Thank you for contacting us. We will be in touch with you very soon. <?php } ?> Quote Link to comment Share on other sites More sharing options...
Jessica Posted January 29, 2013 Share Posted January 29, 2013 Will it? Why would you ask us? Try it and see. Quote Link to comment Share on other sites More sharing options...
SebbieHE Posted January 29, 2013 Author Share Posted January 29, 2013 Because I haven't bought my domain/hosting package yet. Unless there is a free one that supports php? Quote Link to comment Share on other sites More sharing options...
Jessica Posted January 29, 2013 Share Posted January 29, 2013 Set up a local host. You cannot write PHP without being able to test it yourself, and we are not here to test your code. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.