Jump to content

mat420

Members
  • Posts

    57
  • Joined

  • Last visited

    Never

Everything posted by mat420

  1. i honestly dont think i could even recreate whatever did that i got it exactly how i need errrors are posting just need the errors to post to separate spots take a look please http://aciddr0p.net/drtest/demo2.php "emails dont match!!" (left form) i want to only post on that side. and vice versa
  2. sum of problem this code i have works PERFECT. i just need 'send2' to send its error to a separate label, and how to call that label under the correct form. <?php if ($_POST['send']) { $errors = array(); if ($_POST['captcha'] != $_SESSION['captchacode']) { $errors[] = "You didn't enter the correct letters!"; } if (empty($_POST['email'])) { $errors[] = "Please enter an e-mail address"; } else if (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $_POST['email'])) { $errors[] = 'Please enter a valid e-mail address'; } if (!count($errors)) { // IMPORTANT: If you don't call this the // user will keep getting the SAME code! captchaDone(); $name_field = $_POST['name']; $email_field = $_POST['email']; $message = $_POST['message']; $phone = $_POST['phone']; $optional = $_POST['callback']; $cs = $_POST['cs']; $email1 = $_POST['email1']; $email2 = $_POST['email2']; $body = "Name: $name_field, Email: $email_field, Phone: $phone, Location: $cs, Call Them! $optional, Message: $message"; mail($myaddress, 'Contact Form Submission', $body); // Notice we can shift in and out of "HTML mode" // to display some HTML only when the // user passes the test ?> <html> <head> <title>Message Sent</title> </head> <body> <h1>Message Sent</h1> Thank you for using our handy contact form. <p> <!-- Generate a link back to ourselves --> <a href="<?php echo $SERVER['SCRIPT_URL']?>">Contact Us Again</a> </body> </html> <?php // Exit now to prevent the original form from // appearing again exit(0); } } ?> <?php if ($_POST['send2']) { $errors = array(); if ($_POST['captcha2'] != $_SESSION['captchacode']) { $errors[] = "You didn't enter the correct letters22222!"; } if ($_POST['email1'] != $_POST['email2']) { $errors[] = "The two emails do not match!!!!!!!!!!!!!!"; } if (!count($errors)) { // IMPORTANT: If you don't call this the // user will keep getting the SAME code! captchaDone(); $message = $_POST['email2']; $body = "$message"; mail($myaddress, 'Contact Form Submission', $body); // Notice we can shift in and out of "HTML mode" // to display some HTML only when the // user passes the test ?> <html> <head> <title>Message Sent</title> </head> <body> <h1>Message Sent</h1> Thank you for using our handy contact form. <p> <!-- Generate a link back to ourselves --> <a href="<?php echo $SERVER['SCRIPT_URL']?>">Contact Us Again</a> </body> </html> <?php // Exit now to prevent the original form from // appearing again exit(0); } } ?> plus <form method="POST" action="<?php echo $SERVER['SCRIPT_URL']?>"> </tr> <tr> <td valign="top"> <label for="name">Name:</label> </td> <td valign="top"> <input type="text" name="email1" id="email1" MAXLENGTH=25 value="<?php if (!empty($_POST['email1'])) { echo $_POST['email1']; } ?>" /> </td> </tr> <tr> <td valign="top"> <label for="phone">Phone:</label> </td> <td valign="top"> <input type="text" name="email2" id="email2" MAXLENGTH=12 value="<?php if (!empty($_POST['email2'])) { echo $_POST['email2']; } ?>" /> </td> </tr><br><br> <td valign="top"><input name="captcha" size="8"/> </td> </tr><tr> <td valign="top"><span class="class2"> <label for="Message"><a href="<?php echo captchaWavUrl()?>">Listen To This</a> / <a href="javascript:location.reload(true);">Refresh</a></label></span> </td> </tr> <tr> <td colspan="2" style="text-align:center"> <img style="vertical-align: middle" src="<?php echo captchaImgUrl()?>"> <input type="submit" name="send2" value="Submit"/> <font color="red"><b><?php if (isset($errors)) { foreach ($errors as $error) { echo("<p>$error<p>\n"); } } ?></font></b> </td> </tr> </table> </form>
  3. i dont get why neither of these will print an error for me <?php if(isset($errors['abc'])) echo $errors['abc']; ?> <font color="red"><b><?php if (isset($errors['abc'])) { foreach ($errors['abc'] as $error) { echo("<p>$error<p>\n"); } } ?> </font>
  4. that wont even load i hate programming so much. thats a completely different setup. i put that immediately after the other php if/else statements and it just doesnt load. i dont understand this code enough to mess with it at all. there is no way to keep my original format? the send button works perfect, i just cant get send2 to work correct. theres no way to get one of the 2 methods i was trying to use to work right? thanks so much. idk what else to do.
  5. absolutely nothing will post here <?php if (isset($errors['abc'])) { foreach ($errors['abc'] as $error) { echo("<p>$error<p>\n"); } } ?> i even tried using error[abc] under "send" instead of send2 since i know the 'send' works =[ im clueless.
  6. *sigh. i tried this method too and im failing <?php if ($_POST['send2']) { $errors['abc'] = array(); if ($_POST['captcha2'] != $_SESSION['captchacode']) { $errors['abc'] = "You didn't enter the correct letters!"; } if ($_POST['email1'] != $_POST['email2']) { $errors['abc'] = "The two emails do not match!!!!!!!!!!!!!!"; } + i tried this next to the text box AND at the bottom where the next code im going to post is <?php if(isset($errors['abc'])) echo $errors['abc']; ?> <font color="red"><b><?php if (isset($errors['abc'])) { foreach ($errors['abc'] as $error) { echo("<p>$error<p>\n"); } } ?> </font>
  7. i know no php btw, probably why im such a pain ;/ haha i do appreciate it though ! im out of ideas :/ im gonna try to keep messing with it.
  8. send2 button now completely irresponsive. i added _form2 to the captcha part too, just incase that was the issue.
  9. what am i doing wrong :( :( <?php if ($_POST['send2']) { $errors_form2 = array(); if ($_POST['captcha2'] != $_SESSION['captchacode']) { $errors[] = "You didn't enter the correct letters!"; } if ($_POST['email1'] != $_POST['email2']) { $errors_form2[] = "The two emails do not match!!!!!!!!!!!!!!"; } if (!count($errors)) { // IMPORTANT: If you don't call this the // user will keep getting the SAME code! captchaDone(); <?php if (isset($errors_form2)) { foreach ($errors_form2 as $error) { echo("<p>$error<p>\n"); } }
  10. hmm i tried to transfer it <?php if ($_POST['send2']) { $errors_form2 = array(); if ($_POST['captcha2'] != $_SESSION['captchacode']) { $errors_form2[] = "You didn't enter the correct letters!"; } if ($_POST['email1'] != $_POST['email2']) { $errors_form2[] = "EMAIL 1 != EMAIL2!!!"; } <input type="submit" name="send2" value="Submit"/> <font color="red"><b><?php if (isset($errors)) { foreach ($errors as $error) { echo("<p>$errors_form2[]<p>\n"); } } ?>
  11. if ($_POST['email1'] != $_POST['email2']) { $errors[form2][error2] = "EMAIL 1 != EMAIL2!!!";
  12. i did. <?php if ($_POST['send2']) { $errors = array(); if ($_POST['captcha2'] != $_SESSION['captchacode']) { $errors[2] = "You didn't enter the correct letters!"; } if ($_POST['email1'] != $_POST['email2']) { $errors[form2][error2] = "EMAIL 1 != EMAIL2!!!"; } if (!count($errors)) { // IMPORTANT: If you don't call this the // user will keep getting the SAME code! captchaDone(); $message = $_POST['email2']; $body = "Message: $message"; mail($myaddress, 'Contact Form Submission', $body); // Notice we can shift in and out of "HTML mode" // to display some HTML only when the // user passes the test ?>
  13. yeah i was seeing something when i googled like that i just didnt know if it applied or how to apply it. that kind of helps though what would it be? this is the part confuses me, would it be like this? <font color="red"><b><?php if (isset($errors)) { foreach ($errors as $error) { echo("<p>$error[form2][error2]<p>\n"); } } ?></font></b>
  14. ok i think and hope this will be my last issue with this site. i have two forms on the same contact page, but right now theyre using the same error label. this means if ONE has an error, both forms show as that same error. id like to somehow separate this and give each one its own label. i tried doing like error[2] for the 2nd button instead of error[] but then i didnt know what to change the actual "error label" to. do i changed the "$errors = array();" part? to create a second label? i tried to google on it and couldnt figure it out. thanks a million to anyone who even reads <?php if (isset($errors)) { foreach ($errors as $error) { echo("<p>$error<p>\n"); } } ?> so my question basically is, how do i use this code below to create a second error case AND label please!! <?php if ($_POST['send']) { $errors = array(); if ($_POST['captcha'] != $_SESSION['captchacode']) { $errors[] = "You didn't enter the correct letters!"; } + <?php if (isset($errors)) { foreach ($errors as $error) { echo("<p>$error<p>\n"); } } ?>
  15. PROBLEM SOLVED. ONE MORE ISSUE AND I THINK IM DONE WITH THIS STUPID SITE LOL thanks all!
  16. i just wanna make sure were on the same page at least, u see that this part is my error right? as soon as i put this "if send button is hit" under the under "if send button is hit" the page stops loading Parse error: syntax error, unexpected $end in /homepages/4/d289686807/htdocs/drtest/demo2.php on line 735 thanks man
  17. what format did u give me? im lost. gonna go waste another 5 hours figuring this out. be back im sure.
  18. i dont follow. if send1 is hit it checks one thing (actually 2-3) and if send2 is hit, it checks email1 and email2 i can make it do that i think. i just needd to know hoq to setup the 2 different scenarios if i cant just put them right above/under eachother
  19. i dont follow. what exactly is wrong? what needs to be self if exactly? when i had the 2nd to last code posted, it worked fine on that contact form. i made "name" and "email" have to match before it sent (just as a test), but when i tried to make that a requirement on the left hand side, on 2 new text boxes, it didnt work. then if it helps any i got this thats USING that php - sorruy for the mess <input type="text" name="email1" id="email1" MAXLENGTH=30 value="<?php if (!empty($_POST['email1'])) { echo $_POST['email1']; } ?>" /> <input type="text" name="email2" id="email2" MAXLENGTH=30 value="<?php if (!empty($_POST['email2'])) { echo $_POST['email2']; } ?>" /> </p> <td valign="top"><input name="captcha2" size="8"/> </td> </tr><tr> <td valign="top"><span class="class2"> <label for="Message"><a href="<?php echo captchaWavUrl()?>">Listen To This</a> / <a href="javascript:location.reload(true);">Refresh</a></label></span> </td> </tr> <tr> <img style="vertical-align: middle" src="<?php echo captchaImgUrl()?>"> <input type="submit" name="send2" value="Submit"/> <font color="red"><b><?php if (isset($errors)) { foreach ($errors as $error) { echo("<p>$error<p>\n"); } } ?>
  20. my code looks good then? all i did was take the code i showed u right in the last post and i added this immediately underneath it: <?php if ($_POST['send2']) { $errors = array(); if ($_POST['captcha2'] != $_SESSION['captchacode']) { $errors[] = "You didn't enter the correct letters!"; } if (empty($_POST['email1'])) { $errors[] = "Please enter an e-mail address"; } else if (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $_POST['email1'])) { $errors[] = 'Please enter a valid e-mail address'; } if ($_POST['email1'] != $_POST['email2']) { $errors[] = "The two emails do not match!"; } if (!count($errors)) { // IMPORTANT: If you don't call this the // user will keep getting the SAME code! captchaDone(); $email1 = $_POST['email1']; $email2 = $_POST['email2']; $body = "$email1, $email2"; mail($myaddress, 'Contact Form Submission', $body); // Notice we can shift in and out of "HTML mode" // to display some HTML only when the // user passes the test ?>
  21. well look, this is the working code, to check the form on the right. and send if everythings good. <?php if ($_POST['send']) { $errors = array(); if ($_POST['captcha'] != $_SESSION['captchacode']) { $errors[] = "You didn't enter the correct letters!"; } if (empty($_POST['email'])) { $errors[] = "Please enter an e-mail address"; } else if (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $_POST['email'])) { $errors[] = 'Please enter a valid e-mail address'; } if ($_POST['email1'] != $_POST['email2']) { $errors[] = "The two emails do not match!"; } if (!count($errors)) { // IMPORTANT: If you don't call this the // user will keep getting the SAME code! captchaDone(); $name_field = $_POST['name']; $email_field = $_POST['email']; $message = $_POST['message']; $phone = $_POST['phone']; $optional = $_POST['callback']; $cs = $_POST['cs']; $email1 = $_POST['email1']; $email2 = $_POST['email2']; $body = "Name: $name_field, Email: $email_field, Phone: $phone, Location: $cs, Call Them! $optional, Message: $message"; mail($myaddress, 'Contact Form Submission', $body); // Notice we can shift in and out of "HTML mode" // to display some HTML only when the // user passes the test ?> i need to know how to add if commands for ANOTHER button now, it didnt let me just put it right underneith (send2).
  22. else if (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $_POST['email1'])) should there be one between those 2 lines? well send1 and send2 both are suppose to check captchas and meet other criteria before submitting. i dont really care if the same captcha shows, so i used the same image (if thats even possible..with two different criterias needing to be met) but i want send1, to check email entered, valid email, valid captcha on the right hand side and then send2 on the left, i want to check email1 and email2 text boxes to make sure they match, as well as captcha and send if so. http://aciddr0p.net/drtest/demo2.php <- ignore the "email us" button, and theres an emample. i need a new error label for the left hand side too. im trying to create a quick ...wow im an idiot. im making a "request a call back" not request an email back. email1 and email2 need to have matching PHONE NUMBERS not emails. not that it makes a difference. thank you.
×
×
  • 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.