-
How to validate a session() multi page form using php?
I would like to make sure that there are no empty fields. I would like to addif (! 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)
{
?>
Sorry, there were no replies found.