• GoDaddy Community
  • Websites + Marketing | Website Builders
  • Websites + Marketing | Website Builders

    Showing results for 
    Show  only  | Search instead for 
    Did you mean: 
    Go to solution

    Validating form data in PHP



    I'm trying to figure out how to manage form validation using PHP.
    I have read a number of articles on this subject and they all seem to focus on submitting the
    form to itself using this action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); thing.

    I'm a raw beginner at PHP and I'm trying to duplicate what I would do in Java J2EE (15 yrs+)

    That is display page for input, submit to validation resource (servlet), validate.
    if valid then save data and forward to success page else set errors on session and return to
    input page displaying errors. This is clean and easy to understand and keeps
    validation out of the source.


    Is there a way to do this in PHP
    Does PHP have a session object or similar?
    If not, how does one maintain session state over a stateless protocol (http)

    Madwomans Dad

    3 REPLIES 3

    Re: Validating form data in PHP

    OIC Thats how its done

    I'll be back

    Community Manager
    Community Manager

    Re: Validating form data in PHP

    Hi @madwoman84,

    It would be super helpful to other GoDaddy community members if you'd come back and post what you learned in order to solve the issue you were having. Thanks much!



    Re: Validating form data in PHP

    redirect using header("location: path/to/required/resource.php");


    $_SESSION, session_start()

    but see above re why these don't  seem to work