Jump to content

Joseph_R

Members
  • Posts

    5
  • Joined

  • Last visited

Joseph_R's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Yes, but with a success message for example "thank you, your message has been submitted" After some headaches i managed to find a way to make my whole page's content show after a successful email was sent. I made a separate page with only the form then placed it on my main page using an iframe, when a successful email was sent it reloads with the success message and my whole page's content was shown. You were no help at all hahaha, just saying.... but i still appreciated the replies as some forums never reply to people until months after. Anyways Thanks again.
  2. Hello again, I understand about not pasting the complete rewritten php code (god helps those who help them self) but none of you explain to me how to echo the success message only how to echo the error messages which is already functional in the code. All of my error messages echos correctly, its the success message i would like to echo instead of a success page. Thanks in advance.
  3. Hello again, Let me start first by saying Thank You to Jessica, Boompa and Strider64 for replying kindly to help me but i am also new to php and I'm still at a lost. Can one of you put the full re-written php code for me along with the short code for me to place where i would like the success message to appear ? At the bottom of the form's submit button i used this code below to echo the error messages if a field is missing. This text shows up where i placed the code. <? echo $error; ?> When the form has been submitted succesfull it reloads the page showing the text from this part of the php code: // Email has sent successfully, echo a success page. echo "<div id='succsess_page'>"; echo "<em>Email Sent Successfully.</em>"; echo "<p>Thank you <strong>$name</strong>, your message has been submitted to us.</p>"; echo "</div>"; But when it reloads it only shows part of my web page along with the success message, my menu and other parts of my web page do not show. Is there any way to get this success text showing where i placed the code for the error messages ?
  4. Hello to all php gurus, I'm new here and hoping someone kind can help me with a small issue on php form i have. 1st i would like is to echo a success message the same way the script echos error messages when one of the form feilds is empty. 2nd is i would like to do this by adding a peice of code where i want the success message to appear. For the error messages the script uses this piece of code here to echo the error messages where i want it to appear. "<? echo $error; ?>" if possible i want to use a similar code to echo the success message where i want it to appear, the full form code is below. <? // Attention! Please read the following. // It is important you do not edit pieces of code that aren't tagged as a configurable options identified by the following: // Configuration option. // Each option that is easily editable has a modified example given. $error = ''; $name = ''; $email = ''; //$phone = ''; Remove the // tags and this text to active phone number. $subject = ''; $comments = ''; $verify = ''; if(isset($_POST['contactus'])) { $name = $_POST['name']; $email = $_POST['email']; //$phone = $_POST['phone']; Remove the // tags and this text to active phone number. $subject = $_POST['subject']; $comments = $_POST['comments']; $verify = $_POST['verify']; // Configuration option. // You may change the error messages below. // e.g. $error = 'Attention! This is a customised error message!'; if(trim($name) == '') { $error = '<div class="error_message">Attention! You must enter your name.</div>'; } else if(trim($email) == '') { $error = '<div class="error_message">Attention! Please enter a valid email address.</div>'; // Configuration option. // Remove the // tags below to active phone number. //} else if(!is_numeric($phone)) { // $error = '<div class="error_message">Attention! Phone number can only contain digits.</div>'; } else if(!isEmail($email)) { $error = '<div class="error_message">Attention! You have enter an invalid e-mail address, try again.</div>'; } if(trim($subject) == '') { $error = '<div class="error_message">Attention! Please enter a subject.</div>'; } else if(trim($comments) == '') { $error = '<div class="error_message">Please enter your message.</div>'; } else if(trim($verify) == '') { $error = '<div class="error_message">Attention! Please enter the verification number.</div>'; } else if(trim($verify) != '4') { $error = '<div class="error_message">Attention! The verification number you entered is incorrect.</div>'; } if($error == '') { if(get_magic_quotes_gpc()) { $comments = stripslashes($comments); } // Configuration option. // Enter the email address that you want to emails to be sent to. // Example $address = "example@example.com"; $address = "example@example.com"; // Configuration option. // i.e. The standard subject will appear as, "You've been contacted by John Doe." // Example, $e_subject = '$name . ' has contacted you via Your Website.'; $e_subject = 'You\'ve been contacted by ' . $name . '.'; // Configuration option. // You can change this if you feel that you need to. // Developers, you may wish to add more fields to the form, in which case you must be sure to add them here. $e_body = "You have been contacted by $name with regards to $subject, their additional message is as follows.\r\n\n"; $e_content = "\"$comments\"\r\n\n"; // Configuration option. // RIf you active phone number, swap the tags of $e-reply below to include phone number. //$e_reply = "You can contact $name via email, $email or via phone $phone"; $e_reply = "You can contact $name via email, $email"; $msg = $e_body . $e_content . $e_reply; mail($address, $e_subject, $msg, "From: $email\r\nReply-To: $email\r\nReturn-Path: $email\r\n"); // Email has sent successfully, echo a success page. echo "<div id='succsess_page'>"; echo "<em>Email Sent Successfully.</em>"; echo "<p>Thank you <strong>$name</strong>, your message has been submitted to us.</p>"; echo "</div>"; } } if(!isset($_POST['contactus']) || $error != '') // Do not edit. { ?> 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.