Jump to content

newtotheland

Members
  • Posts

    20
  • Joined

  • Last visited

Everything posted by newtotheland

  1. Hi all Im trying to work out the php I need for this form code html. <div id="main"> <h1>Contact</h1> <p> Feel free to send us a message with your ideas or questions and we will get back to you as soon as we can! We try to answer you within the hour! </p> <form action="#" method="post"> <label>Name</label> <input type="text" value=""> <label>Email Address</label> <input type="text" value=""> <label>Contact Number</label> <input type="text" value=""> <label>Message</label> <textarea></textarea> <input type="submit" value="Send Message" class="btn1"> </form> </div> Its very basic but all I want is a simple email sent to specified email add with these four bits of info. Any ideas would be great thanks.
  2. legend AyKay that works like a dream man, thanks :):)
  3. hi all eventually created second directory on server called uploads2 and created new path? I guess which works. Code below. Happy enough, all I have to do is look in two different folders instead of one which isnt a biggie. Thanks loads for responses all, code below.. $target_path = "uploads/"; $target_path = $target_path . basename( $_FILES['selectedfile']['name']); if(move_uploaded_file($_FILES['selectedfile']['tmp_name'], $target_path)) { echo "The file ". basename( $_FILES['selectedfile']['name']). " has been uploaded"; } else{ echo "There was an error uploading the file, please try again!"; } $target_path = "uploads2/"; $target_path = $target_path . basename( $_FILES['selectedfile2']['name']); if(move_uploaded_file($_FILES['selectedfile2']['tmp_name'], $target_path)) { echo "The file ". basename( $_FILES['selectedfile2']['name']). " has been uploaded"; } else{ echo "There was an error uploading the file, please try again!"; }
  4. ah ok that makes sense, any suggestion as to what might work instead?
  5. Hi Berridgeab, sorry for not responding sooner was away for 3 days, thanks again for your reply which resolved the problem but I need it to work for multiple files. Ive tried numerous methods over the last few days but nothings worked. The code below works well but the problem is the 2 files somehow merge into one during upload and when they get to the server and are either corrupt or only have one of the files info in them. Even though on the server the file has a combination of both names. for example, if I upload filea.pdf and fileb.jpeg the filename on the server becomes filea.fileb.jpeg <td style= "position:absolute; top:272px; left:570px"form enctype="multipart/form-data" action="html_form_send.php" method="post"> Upload file 1: <input type="file" name="selectedfile" /> </td> <td style= "position:absolute; top:316px; left:570px"form enctype="multipart/form-data" action="html_form_send.php" method="post"> Upload file 2: <input type="file" name="selectedfile2" /> </td> and the php to look like this: $headers = 'From: '.$email_from."\r\n". 'Reply-To: '.$email_from."\r\n" . 'X-Mailer: PHP/' . phpversion(); @mail($email_to, $email_subject, $email_message, $headers); $target_path = "uploads/"; $target_path = $target_path . basename( $_FILES['selectedfile']['name']) .basename( $_FILES['selectedfile2']['name']); if(move_uploaded_file($_FILES['selectedfile']['tmp_name'], $target_path)) { echo "The file ". basename( $_FILES['selectedfile']['name']). " has been uploaded"; } else{ echo "There was an error uploading the file, please try again!"; } if(move_uploaded_file($_FILES['selectedfile2']['tmp_name'], $target_path)) { echo "The file ". basename2( $_FILES['selectedfile2']['name']). " has been uploaded"; } else{ echo "There was an error uploading the file, please try again!"; } most probably something minor and to do with basename but cant get final bit worked out. Any idea as to why its merging em? Thanks again
  6. <?php if(isset($_POST['email'])) { // CHANGE THE TWO LINES BELOW $email_to = "admin@penaltysolutions.co.uk"; $email_subject = "New Entry"; function died($error) { // your error code can go here echo "We're sorry, but there are errors found with the form you submitted.<br /><br />"; echo $error."<br /><br />"; echo "Please go back and fix these errors.<br /><br />"; die(); } // validation expected data exists if(!isset($_POST['first_name']) || !isset($_POST['last_name']) || !isset($_POST['email']) || !isset($_POST['telephone']) || !isset($_POST['comname']) || !isset($_POST['comweb']) || !isset($_POST['comments'])){ died('We are sorry, but there appears to be a problem with the form you submitted.'); } $first_name = $_POST['first_name']; // required $last_name = $_POST['last_name']; // required $email_from = $_POST['email']; // required $telephone = $_POST['telephone']; // not required $comments = $_POST['comments']; // required $comweb = $_POST['comweb']; $comname = $_POST['comname']; $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 .= "First Name: ".clean_string($first_name)."\n"; $email_message .= "Last Name: ".clean_string($last_name)."\n"; $email_message .= "Email: ".clean_string($email_from)."\n"; $email_message .= "Telephone: ".clean_string($telephone)."\n"; $email_message .= "Comments: ".clean_string($comments)."\n"; $email_message .= "Comweb: ".clean_string($comweb)."\n"; $email_message .= "Commname: ".clean_string($comname)."\n"; // create email headers $headers = 'From: '.$email_from."\r\n". 'Reply-To: '.$email_from."\r\n" . 'X-Mailer: PHP/' . phpversion(); @mail($email_to, $email_subject, $email_message, $headers); $target_path = "uploads/"; $target_path = $target_path . basename( $_FILES['uploadedfile']['name']); if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) { echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded"; } else{ echo "There was an error uploading the file, please try again!"; } ?> <!-- place your own success html below --> <html> <head> <meta charset="utf-8" /> <title>Penalty Solutions Uk</title> <link rel="stylesheet" type="text/css" href="style.css" media="all" /> </head> <body> <div id="header"> <div id="logo"> <a href="index.html"><img src="images/logo.jpg" alt="" /></a> </div> <ul> <li><a href="index.html"><span>home</span></a></li> <li><a href="about.html"><span>about us</span></a></li> <li><a href="services.html"><span>services</span></a></li> <li><a href="products.html"><span>products</span></a></li> <li><a href="contact us1.html"><span>contact us</span></a></li> </ul> </div> <div> </div> <div> </div> <div> </div> <div> </div> <div> </div> <DIV style="position: absolute; top:300px; left:450px; width:900px; height:45px">Thank you for contacting us. We will be in touch with you very soon.</DIV> <?php } die(); ?>
  7. <form name="htmlform" method="post" action="html_form_send.php"enctype="multipart/form-data"> <table width="450px"> </tr> <tr> <td style= "position:absolute; top:265px; left:280px"> <label for="first_name">First Name *</label> </td> <td style= "position:absolute; top:285px; left:280px"> <input type="text" name="first_name" maxlength="50" size="30"> </td> </tr> <tr> <td style= "position:absolute; top:313px; left:280px"> <label for="last_name">Last Name *</label> </td> <td style= "position:absolute; top:333px; left:280px"> <input type="text" name="last_name" maxlength="50" size="30"> </td> </tr> <tr> <td style= "position:absolute; top:356px; left:280px"> <label for="email">Email Address *</label> </td> <td style= "position:absolute; top:376px; left:280px"> <input type="text" name="email" maxlength="80" size="30"> </td> </tr> <tr> <td style= "position:absolute; top:400px; left:280px"> <label for="comname">Company name </label> </td> <td style= "position:absolute; top:420px; left:280px"> <input type="text" name="comname" maxlength="50" size="30"> </td> </tr> <tr> <td style= "position:absolute; top:356px; left:570px"> <label for="comweb">Company website </label> </td> <td style= "position:absolute; top:376px; left:570px"> <input type="text" name="comweb" maxlength="50" size="30"> </td> </tr> <tr> <td style= "position:absolute; top:400px; left:570px"> <label for="telephone">Telephone Number *</label> </td> <td style= "position:absolute; top:420px; left:570px"> <input type="text" name="telephone" maxlength="30" size="30"> </td> </tr> <tr> <td style= "position:absolute; top:446px; left:280px"> <label for="comments">Description of circumstances *</label> </td> <td style= "position:absolute; top:469px; left:280px"> <textarea name="comments" maxlength="1000" cols="68" rows="6"></textarea> </td> <td style= "position:absolute; top:272px; left:570px" enctype="multipart/form-data" action="html_form_send.php" method="POST" > Upload file 1: <input type="file" name="uploaded file" /> </td> <td style= "position:absolute; top:316px; left:570px" enctype="multipart/form-data"action="html_form_send.php" method="POST" > Upload file 2: <input type="file" name="uploaded file" /> </td> </tr> <tr> <td style= "position:absolute; top:500px; left:930px"colspan="2" style="text-align:center"> <input type="submit" value="Upload file"> </td> </tr> </table> </form>
  8. basically the name, surname etc process goes through, after you submit you get thank you for submitting reply but in top left corner it states "There was an error uploading the file, please try again!". ANd file is no where on directory or part of the email my admin email gets. its online here www.penaltysolutions.co.uk code tags done below.
  9. Hi I thought I had this solved but its still kicking, I need html and php for this site please. www.penaltysolutions.co.uk ALl I want to be able to do is allow people to upload two pdf's, text files or images not exceeding 20 meg in one go which should be emailed to my site email with the other contact us form info... everything works except the file uploads. Currently contact.html page looks like this: <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>Penalty Solutions Uk</title> <link rel="stylesheet" type="text/css" href="style.css" media="all" /> </head> <body> <div id="header"> <div style= "position:absolute; top:270px; left:930px" <li><img border="0" src="images/contact us today.jpg"</li> </div> <div id="logo"> <a href="index.html"><img src="images/logo.jpg" alt="" /></a> </div> <ul> <li><a href="index.html"><span>home</span></a></li> <li><a href="about.html"><span>about us</span></a></li> <li><a href="services.html"><span>services</span></a></li> <li><a href="products.html"><span>info</span></a></li> <li class="selected"><a href="contact.html"><span>contact us</span></a></li> </ul> </div> <div id="body"> <div class="header"> <div> <ul> <form name="htmlform" method="post" action="html_form_send.php"enctype="multipart/form-data"> <table width="450px"> </tr> <tr> <td style= "position:absolute; top:265px; left:280px"> <label for="first_name">First Name *</label> </td> <td style= "position:absolute; top:285px; left:280px"> <input type="text" name="first_name" maxlength="50" size="30"> </td> </tr> <tr> <td style= "position:absolute; top:313px; left:280px"> <label for="last_name">Last Name *</label> </td> <td style= "position:absolute; top:333px; left:280px"> <input type="text" name="last_name" maxlength="50" size="30"> </td> </tr> <tr> <td style= "position:absolute; top:356px; left:280px"> <label for="email">Email Address *</label> </td> <td style= "position:absolute; top:376px; left:280px"> <input type="text" name="email" maxlength="80" size="30"> </td> </tr> <tr> <td style= "position:absolute; top:400px; left:280px"> <label for="comname">Company name </label> </td> <td style= "position:absolute; top:420px; left:280px"> <input type="text" name="comname" maxlength="50" size="30"> </td> </tr> <tr> <td style= "position:absolute; top:356px; left:570px"> <label for="comweb">Company website </label> </td> <td style= "position:absolute; top:376px; left:570px"> <input type="text" name="comweb" maxlength="50" size="30"> </td> </tr> <tr> <td style= "position:absolute; top:400px; left:570px"> <label for="telephone">Telephone Number *</label> </td> <td style= "position:absolute; top:420px; left:570px"> <input type="text" name="telephone" maxlength="30" size="30"> </td> </tr> <tr> <td style= "position:absolute; top:446px; left:280px"> <label for="comments">Description of circumstances *</label> </td> <td style= "position:absolute; top:469px; left:280px"> <textarea name="comments" maxlength="1000" cols="68" rows="6"></textarea> </td> <td style= "position:absolute; top:272px; left:570px" enctype="multipart/form-data" action="html_form_send.php" method="POST" > Upload file 1: <input type="file" name="uploaded file" /> </td> <td style= "position:absolute; top:316px; left:570px" enctype="multipart/form-data"action="html_form_send.php" method="POST" > Upload file 2: <input type="file" name="uploaded file" /> </td> </tr> <tr> <td style= "position:absolute; top:500px; left:930px"colspan="2" style="text-align:center"> <input type="submit" value="Upload file"> </td> </tr> </table> </form> <div id="body"> <div class="about"> </div> </div> <h2></h2> </div> </div> <h2></h2> </div> </div> <div id="footer"> <div> <div> <h3>Contact us</h3> <ul> <li>457-380-1654 - main</li> <li>PenaltySolutionsUK - Skype</li> </ul> </div> <div> <h3>General Info</h3> <ul> <li><li><a style = "font 16pt arial; color:#818a8c;"; href="products.html"><span>Costs explained</span></a></li></li> <li><li><a style = "font 16pt arial; color:#818a8c;"; href="products.html"><span>PCN issue statistics</span></a></li></li> </ul> </div> <div> <h3>Information</h3> <ul> <li><a style = "font 16pt arial; color:#818a8c;"; href="about.html"><span>Methodology</span></a></li> <li><a style = "font 16pt arial; color:#818a8c;"; href="about.html"><span>Terms and conditions</span></a></li> </ul> </div> <div> <h3>Privacy</h3> <ul> <li><a style = "font 16pt arial; color:#818a8c;"; href="contact.html"><span>Privacy policy</span></a></li> <li><a style = "font 16pt arial; color:#818a8c;"; href="contact.html"><span>Data Protection Act 1998</span></a></li> </ul> </div> <div> <h3>follow us:</h3> <a class="facebook" href="http://facebook.com/parkingsolutionsuk" target="_blank">facebook</a> <a class="twitter" href="http://twitter.com/parkingsolutionsuk" target="_blank">twitter</a> </div> </div> <div> <p>&copy Copyright 2012. All rights reserved</p> </div> </div> </body> </body> </html> and html_form_send.php looks like this: <?php if(isset($_POST['email'])) { // CHANGE THE TWO LINES BELOW $email_to = "admin@penaltysolutions.co.uk"; $email_subject = "New Entry"; function died($error) { // your error code can go here echo "We're sorry, but there are errors found with the form you submitted.<br /><br />"; echo $error."<br /><br />"; echo "Please go back and fix these errors.<br /><br />"; die(); } // validation expected data exists if(!isset($_POST['first_name']) || !isset($_POST['last_name']) || !isset($_POST['email']) || !isset($_POST['telephone']) || !isset($_POST['comname']) || !isset($_POST['comweb']) || !isset($_POST['comments'])){ died('We are sorry, but there appears to be a problem with the form you submitted.'); } $first_name = $_POST['first_name']; // required $last_name = $_POST['last_name']; // required $email_from = $_POST['email']; // required $telephone = $_POST['telephone']; // not required $comments = $_POST['comments']; // required $comweb = $_POST['comweb']; $comname = $_POST['comname']; $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 .= "First Name: ".clean_string($first_name)."\n"; $email_message .= "Last Name: ".clean_string($last_name)."\n"; $email_message .= "Email: ".clean_string($email_from)."\n"; $email_message .= "Telephone: ".clean_string($telephone)."\n"; $email_message .= "Comments: ".clean_string($comments)."\n"; $email_message .= "Comweb: ".clean_string($comweb)."\n"; $email_message .= "Commname: ".clean_string($comname)."\n"; // create email headers $headers = 'From: '.$email_from."\r\n". 'Reply-To: '.$email_from."\r\n" . 'X-Mailer: PHP/' . phpversion(); @mail($email_to, $email_subject, $email_message, $headers); $target_path = "uploads/"; $target_path = $target_path . basename( $_FILES['uploadedfile']['name']); if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) { echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded"; } else{ echo "There was an error uploading the file, please try again!"; } ?> <!-- place your own success html below --> <html> <head> <meta charset="utf-8" /> <title>Penalty Solutions Uk</title> <link rel="stylesheet" type="text/css" href="style.css" media="all" /> </head> <body> <div id="header"> <div id="logo"> <a href="index.html"><img src="images/logo.jpg" alt="" /></a> </div> <ul> <li><a href="index.html"><span>home</span></a></li> <li><a href="about.html"><span>about us</span></a></li> <li><a href="services.html"><span>services</span></a></li> <li><a href="products.html"><span>products</span></a></li> <li><a href="contact us1.html"><span>contact us</span></a></li> </ul> <div> </div> <DIV style="position: absolute; top:300px; left:450px; width:900px; height:45px">Thank you for contacting us. We will be in touch with you very soon.</DIV> <?php } die(); ?> Would once again really appreciate some wisdom.
  10. thanks, Im reviewing it now, gonna have to get my head around it, my php file is called html_send_form.php and I already see the 1st prob in html below </td> <td style= "position:absolute; top:272px; left:570px"action="index.php" enctype="multipart/form-data"> Upload file 1: <input type="file" name="selectedfile" /> </td> <td style= "position:absolute; top:316px; left:570px"action="index.php" enctype="multipart/form-data"> Upload file 2: <input type="file" name="selectedfile" /> </td> appreciate the time psycho
  11. I havent added any, Ive tried this below $email_to = "admin@penaltysolutions.co.uk"; $email_subject = "New Entry"; function died($error) { // your error code can go here echo "We're sorry, but there's errors found with the form you submitted.<br /><br />"; echo $error."<br /><br />"; echo "Please go back and fix these errors.<br /><br />"; die(); } // validation expected data exists if(!isset($_POST['first_name']) || !isset($_POST['last_name']) || !isset($_POST['email']) || !isset($_POST['telephone']) || !isset($_POST['comname']) || !isset($_POST['comweb']) || !isset($_POST['selectedfile1']) || !isset($_POST['selectedfile2']) || !isset($_POST['comments'])){ died('We are sorry, but there appears to be a problem with the form you submitted.'); } $first_name = $_POST['first_name']; // required $last_name = $_POST['last_name']; // required $email_from = $_POST['email']; // required $telephone = $_POST['telephone']; // not required $comments = $_POST['comments']; // required $comweb = $_POST['comweb']; $selectedfile1 = $_POST['selectedfile1']; $selectedfile2 = $_POST['selectedfile2']; but didnt work. Not sure if im even in the right ballpark.
  12. The only other issue is that the file uploads arent coming through with the email, I get all other info except the file uploads. heres the directions from the website I got the form from about adding a upload field, but not sure where it goes. HTML File Upload Field (field selector) Sometimes it may be good to offer your website users the option to upload a file. For this you could use the HTML field type file. If you are using this option you also need to include an additional option to the FORM tag enctype="multipart/form-data" Also attached html contact page below. <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>Penalty Solutions Uk</title> <link rel="stylesheet" type="text/css" href="style.css" media="all" /> </head> <body> <div id="header"> <div style= "position:absolute; top:270px; left:930px" <li><img border="0" src="images/contact us today.jpg"</li> </div> <div id="logo"> <a href="index.html"><img src="images/logo.jpg" alt="" /></a> </div> <ul> <li><a href="index.html"><span>home</span></a></li> <li><a href="about.html"><span>about us</span></a></li> <li><a href="services.html"><span>services</span></a></li> <li><a href="products.html"><span>info</span></a></li> <li class="selected"><a href="contact.html"><span>contact us</span></a></li> </ul> </div> <div id="body"> <div class="header"> <div> <ul> <form name="htmlform" method="post" action="html_form_send.php"enctype="multipart/form-data"> <table width="450px"> </tr> <tr> <td style= "position:absolute; top:265px; left:280px"> <label for="first_name">First Name *</label> </td> <td style= "position:absolute; top:285px; left:280px"> <input type="text" name="first_name" maxlength="50" size="30"> </td> </tr> <tr> <td style= "position:absolute; top:313px; left:280px"> <label for="last_name">Last Name *</label> </td> <td style= "position:absolute; top:333px; left:280px"> <input type="text" name="last_name" maxlength="50" size="30"> </td> </tr> <tr> <td style= "position:absolute; top:356px; left:280px"> <label for="email">Email Address *</label> </td> <td style= "position:absolute; top:376px; left:280px"> <input type="text" name="email" maxlength="80" size="30"> </td> </tr> <tr> <td style= "position:absolute; top:400px; left:280px"> <label for="comname">Company name </label> </td> <td style= "position:absolute; top:420px; left:280px"> <input type="text" name="comname" maxlength="50" size="30"> </td> </tr> <tr> <td style= "position:absolute; top:356px; left:570px"> <label for="comweb">Company website </label> </td> <td style= "position:absolute; top:376px; left:570px"> <input type="text" name="comweb" maxlength="50" size="30"> </td> </tr> <tr> <td style= "position:absolute; top:400px; left:570px"> <label for="telephone">Telephone Number *</label> </td> <td style= "position:absolute; top:420px; left:570px"> <input type="text" name="telephone" maxlength="30" size="30"> </td> </tr> <tr> <td style= "position:absolute; top:446px; left:280px"> <label for="comments">Description of circumstances *</label> </td> <td style= "position:absolute; top:469px; left:280px"> <textarea name="comments" maxlength="1000" cols="68" rows="6"></textarea> </td> <td style= "position:absolute; top:272px; left:570px"action="index.php" enctype="multipart/form-data"> Upload file 1: <input type="file" name="selectedfile" /> </td> <td style= "position:absolute; top:316px; left:570px"action="index.php" enctype="multipart/form-data"> Upload file 2: <input type="file" name="selectedfile" /> </td> </tr> <tr> <td style= "position:absolute; top:500px; left:930px"colspan="2" style="text-align:center"> <input type="submit" value="Submit"> </td> </tr> </table> </form> <div id="body"> <div class="about"> </div> </div> <h2></h2> </div> </div> <h2></h2> </div> </div> <div id="footer"> <div> <div> <h3>Contact us</h3> <ul> <li>457-380-1654 - main</li> <li>PenaltySolutionsUK - Skype</li> </ul> </div> <div> <h3>General Info</h3> <ul> <li><li><a style = "font 16pt arial; color:#818a8c;"; href="products.html"><span>Costs explained</span></a></li></li> <li><li><a style = "font 16pt arial; color:#818a8c;"; href="products.html"><span>PCN issue statistics</span></a></li></li> </ul> </div> <div> <h3>Information</h3> <ul> <li><a style = "font 16pt arial; color:#818a8c;"; href="about.html"><span>Methodology</span></a></li> <li><a style = "font 16pt arial; color:#818a8c;"; href="about.html"><span>Terms and conditions</span></a></li> </ul> </div> <div> <h3>Privacy</h3> <ul> <li><a style = "font 16pt arial; color:#818a8c;"; href="contact.html"><span>Privacy policy</span></a></li> <li><a style = "font 16pt arial; color:#818a8c;"; href="contact.html"><span>Data Protection Act 1998</span></a></li> </ul> </div> <div> <h3>follow us:</h3> <a class="facebook" href="http://facebook.com/...ingsolutionsuk" target="_blank">facebook</a> <a class="twitter" href="http://twitter.com/p...ingsolutionsuk" target="_blank">twitter</a> </div> </div> <div> <p>&copy Copyright 2012. All rights reserved</p> </div> </div> </body> </body> </html>
  13. Thanks Psycho that made sense, I duplicated the "first name" index? to add a company name field and thats where error was coming from. Rectified now,
  14. <?php if(isset($_POST['email'])) { // CHANGE THE TWO LINES BELOW $email_to = "admin@penaltysolutions.co.uk"; $email_subject = "New Entry"; function died($error) { // your error code can go here echo "We're sorry, but there's errors found with the form you submitted.<br /><br />"; echo $error."<br /><br />"; echo "Please go back and fix these errors.<br /><br />"; die(); } // validation expected data exists if(!isset($_POST['first_name']) || !isset($_POST['last_name']) || !isset($_POST['email']) || !isset($_POST['telephone']) || !isset($_POST['comments'])) { died('We are sorry, but there appears to be a problem with the form you submitted.'); } $first_name = $_POST['first_name']; // required $last_name = $_POST['last_name']; // required $email_from = $_POST['email']; // required $telephone = $_POST['telephone']; // not required $comments = $_POST['comments']; // 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 .= "First Name: ".clean_string($first_name)."\n"; $email_message .= "Last Name: ".clean_string($last_name)."\n"; $email_message .= "Email: ".clean_string($email_from)."\n"; $email_message .= "Telephone: ".clean_string($telephone)."\n"; $email_message .= "Comments: ".clean_string($comments)."\n"; // create email headers $headers = 'From: '.$email_from."\r\n". 'Reply-To: '.$email_from."\r\n" . 'X-Mailer: PHP/' . phpversion(); @mail($email_to, $email_subject, $email_message, $headers); ?> <!-- place your own success html below --> <html> <head> <meta charset="utf-8" /> <title>Penalty Solutions Uk</title> <link rel="stylesheet" type="text/css" href="style.css" media="all" /> </head> <body> <div id="header"> <div id="logo"> <a href="index.html"><img src="images/logo.jpg" alt="" /></a> </div> <ul> <li><a href="index.html"><span>home</span></a></li> <li><a href="about.html"><span>about us</span></a></li> <li><a href="services.html"><span>services</span></a></li> <li><a href="products.html"><span>products</span></a></li> <li><a href="contact us1.html"><span>contact us</span></a></li> </ul> </div> <div> </div> <div> </div> <div> </div> <div> </div> <div> </div> <DIV style="position: absolute; top:300px; left:450px; width:900px; height:45px">Thank you for contacting us. We will be in touch with you very soon.</DIV> <?php } die(); ?>
  15. Hi all, fairly new to php, using safari and firefox, copied this free form but for some reason keeps bringing this up when I submit: We're sorry, but there's errors found with the form you submitted. The First Name you entered does not appear to be valid. Please go back and fix these errors. Any idea why this is? Tried with both capital and lower case, website address is www.penaltysolutions.co.uk html_form_send example.php Thanks in advance
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.