thuitamaina Posted February 17, 2016 Share Posted February 17, 2016 Guys, I have solved the issues I was facing in my previous topic. Now I am on this one:if you visit my website (www.thuitamaina.com) and click the contact link and insert details, the right feedback is displayed in a different window and that's after the form box briefly displays a list of errors. Do you have an idea of how I could make the right feedback be displayed in the same form box? So instead of the form box displaying all the errors, it displays the information in the window that loads after the form box disappears. And after the form box should not disappear after displaying the right information, meaning that another window should not be loaded. Below is the concerned code: <?php session_start(); $_SESSION['yourname']=$_POST['yourname']; ?> <div id="shadowing"></div> <div id="seventhbox"> <span id="seventhboxtitle"></span> <!--<form method="post" target="_parent">--> <?php $errors = ''; $myemail = 'thuitamaina@thuitamaina.com';//<-----Put Your email address here. if(empty($_POST['yourname']) || empty($_POST['email_address']) || empty($_POST['Message']) || empty($_POST['captcha'])) { $errors .= "\n Error: all fields are required"; echo '<br>' . $errors . '<br>'; } $yourname = $_POST['yourname']; $email_address = $_POST['email_address']; $Message = $_POST['Message']; $captcha = $_POST['captcha']; if (!preg_match( "/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/i", $email_address)) { $errors .= "\n Error: Invalid email address"; echo '<br>' . $errors . '<br>'; } if ( $captcha != 2) { $errors .= "\n You inserted the wrong number of <b>FULL</b> bananas. You are not a genuine person!"; echo '<br>' . $errors . '<br>'; } if( empty($errors)) { // Include database connection settings include('clinton.php'); $yourname = $_POST['yourname']; $email_address = $_POST['email_address']; $Message = $_POST['Message']; mysql_query("INSERT INTO `thuitam_myDatabase`.`Contact_info` ( `Index` , `Name` , `Email` , `Message` ) VALUES ( NULL, '$yourname', '$email_address','$Message') "); //close connection mysql_close(); $to = $myemail; $email_subject = "Contact form submission: $yourname"; $email_body = "You have received a new message. ". " Here are the details:\n Name: $yourname \n ". "Email: $email_address\n Message \n $Message"; $headers = "From: $myemail\n"; $headers .= "Reply-To: $email_address"; mail($to,$email_subject,$email_body,$headers); //Say 'thank you' //echo '<br>' . $errors . '<br>'; echo '<p>Hi' . $yourname . '!</p> <p>Thank you for contacting me. I will try my best to get back to you as soon as possible. In case I delay in responding, feel free to call me via phone. My number is +254725-509941.</p> <p>Wishing You Every Joy,</p> <p>Thuita J. Maina.</> '; } ?> <button onClick="openbox('Contact', 1)" target="_parent">Contact Again</button> <input type="button" name="cancel" value="Cancel" onClick="closebox()"> <!--</form>--> </div> Quote Link to comment https://forums.phpfreaks.com/topic/300829-issues-solved-now-on-this-issue/ 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.