Hi
Some time ago I created a simple form using php. It was set up to mail me when someone had submitted the form. I have noticed recently that it is working in every other way but not mailing me to let know someone has submitted. I have tried and tried to see a problem in the code but to no avail. Can someone help out here?
This is the code:
thank youCode:<?php require_once("connect/connection.php"); require_once("includes/functions.php"); if(isset($_POST['submit'])){ $errors = array(); $requiredfields = array('first_name'=> 'Please enter your FIRST NAME','surname'=> 'Please enter your SURNAME','email'=> 'Please enter your E Mail ADDRESS','text'=> 'Please enter your current needs'); foreach($requiredfields as $fieldname => $requiredfieldsmessage){ if(!isset($_POST[$fieldname]) || empty($_POST[$fieldname]) || strlen(trim($_POST[$fieldname])) == 0) { $errors[] = $requiredfieldsmessage; } } if(count($errors) == 0){ $_POST = array_map('mysqli_prep', $_POST); $first_name = mysqli_prep($_POST['first_name']); $surname = mysqli_prep($_POST['surname']); $email = mysqli_prep($_POST['email']); $text = mysqli_prep($_POST['text']); $query = "INSERT INTO form (first_name,surname,email,text)Values('{$first_name}','{$surname}','{$email}','{$text}')"; $result = mysqli_query($connection, $query); $message="A contact form has been completed on web-writer-articles.co.uk"; $subject="Ghostwriter contact form"; $subject2="Nick Cassells: Ghostwriter and copywriter"; $message2="Thank you for contacting me concerning your copywriting or ghostwriting needs. I will get back to you at this email address as soon as possible.<br> With best regards,<br> Nick Cassells"; $email2=$email; mail('njc27@sky.com',$subject,$message); mail($email2, $subject2, $message2); header('Location: brief_return.php'); exit; } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>web writer kent, copywriter and SEO kent</title> <meta name="keywords" content="ghostwriter,ghost-writer, writing services, optinise my web site, help me write my book, professional ghost-writer, ghostwriting, how to get my book published, copywriter, web content, articles " /> <meta name= "description" content= "As a professional web writer I can create text that will make your website fly and get picked up by Google." /> <link href="style.css" rel="stylesheet" type="text/css" /> <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-18301581-5']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script> </head> <body> <div id="wrapper"> <div id="header"><div id="headleft"><img src="myimages/copywriter.jpg" alt="Ghost writer, copyriter, internet marketing for you" title="Ghostwriting, Copywriting and internet marketing. Articles for the web at very reasonable prices. Ask me." /> </div><!--headleft--><div id="headright"><img src="myimages/writer.jpg" alt="Ghost writer, copyriter, internet marketing for you" /></div><!--headright--> <ul class="menu"> <li><a href="index.php">Home</a></li> <li><a href="webcontentservices.php">Web Content</a></li> <li><a href="thisisme.php">About me </a></li> <li><a href="ghost_writer.php">Ghostwriter</a></li> <li><a href="http://www.web-writer-articles.co.uk/blog/">SEO Guide</a></li> <li><a href="contact.php">Contact me</a></li> </ul> </div><!--header--> <div id="mainNav"> <img src="myimages/websitecontent.jpg" alt="Do you need to hire a ghost writer?" width="158" height="789" /> </div><!--mainNav--> <div id="content"> <div id="mainContent"> <div id="contactform"><?php if(count($errors) != 0){ echo '<h3>Sorry, please address the following errors:-</h3>'; echo '<ul>'; foreach ($errors as $error) { echo '<li>' . $error . '</li>';}echo '</ul>'; } ?><h3 class="contacttext">For a consultation about your manuscript or a website review for all Intetnet web content needs please contact me. I look forward to hearing from you!</h3> <p class="contacttext">Telephone: 01795 843184 <a href="mailto:njc27@sky.com">Email</a> or fill in the form below and I will get back to you as soon as possible:</p> <form style="padding:15px;" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" > <p>First Name:<br/> <input type="text" size="30" name="first_name" value="<?php echo htmlspecialchars($_POST['first_name'],ENT_QUOTES); ?>" id="fname" /></p> <p> Surname:<br/><input type="text" size="30" name="surname" value="<?php echo htmlspecialchars($_POST['surname'],ENT_QUOTES); ?>" id="sname" /></p> <p>E mail:<br/><input type="text" size="40" name="email" value="<?php echo htmlspecialchars($_POST['email'],ENT_QUOTES); ?>" id="email" /></p> <p>How Can I help you?<br/> <textarea rows="10" cols="40" name="text"><?php echo htmlspecialchars($_POST['text'],ENT_QUOTES); ?> </textarea></p><br /> <input type="submit" name="submit" value="Submit " /> </form> </div>



Reply With Quote


Bookmarks