Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Web Design (WordPress, Joomla, etc.) How to validate a session() multi page form using php?

  • How to validate a session() multi page form using php?

    Posted by Travis Barr on January 31, 2011 at 7:52 am

    I would like to make sure that there are no empty fields. I would like to add

    if (! strlen($_POST['first_name']))
    {
    print 'Please enter your first name.';
    }

    but I am not sure where to add it. any help would be appreciated.

    Thanks.

    <?php

    //Turn on sessions
    session_start();

    //Find what stage to use
    if (($_SERVER['REQUEST_METHOD'] == 'GET') || (!isset($_POST['stage'])))
    {
    $stage = 1;

    }
    else
    {
    $stage = (int) $_POST['stage'];
    }

    // Save any submitted data
    if ($stage > 1)
    {
    foreach ($_POST as $key => $value)
    {
    $_SESSION[$key] = $value;
    }
    }
    if ($stage == 1)
    {
    ?>

    Travis Barr replied 15 years, 7 months ago 1 Member · 0 Replies
  • 0 Replies

Sorry, there were no replies found.

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy