Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Jul 2012
    Thanked 0 Times in 0 Posts

    Data validation, reCaptcha, redirects

    I am designing a simple contact page on my website in php/html. The form has a reCaptcha spam, filter associated with it. My form posts to a separate PHP which checks to see if the Captcha was correct and then send an email of the message to me. However, if the user inputs the wrong Captcha or some other error occurs, a message is printed to the screen. How can I make the script return the contact page, put all the values the user inputted before submission back into the form, and tell the use that the Captcha they entered was incorrect or that they forgot to enter some value? Basically, I want something that looks better than a blank page that the user then has to leave and retype their entire message.

  • #2
    Senior Coder
    Join Date
    Sep 2010
    Thanked 275 Times in 275 Posts
    That takes quite a bit of coding, both in php and/or javascript, to do. When the values are submitted they have to be put into a $_SESSION variable, most easily as an array, then when the page reloads, the values either have to echoed back into the form elements or echoed into javascript which can insert them back into the form elements. You need to use conditionals, i.e. if(isset($_SESSION['vars'])) to prevent errors.
    Welcome to http://www.myphotowizard.net

    where you can edit images, make a photo calendar, add text to images, and do much more.

    When you know what you're doing it's called Engineering, when you don't know, it's called Research and Development. And you can always charge more for Research and Development.


    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts