RE: Redirect then error message to user

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I think what Brent is suggesting is a single script that will handle the
display and processing of all 5 form 'pages'. The code below is just to give
an idea of how I think the 'flow' could go, don't go copying the code and
expect anything (positive) to happen !!


if(!$_POST['step'] || $_POST['step']=='0')
{
  // Display form 1 or call appropriate function/method
  if ($_SESSION['errmsg'])
    echo $errmsg;

  <form .... action="$PHP_SELF?step=1">

}
if($_POST['step']=='1')
{
  // Validate form 1 or call appropriate function/method
  if (error found) {
    $errmsg = "<ul>";
    $errmsg .= "<li>  Field One is required </li>";
    // etc etc
    $_SESSION['errmsg'] = $errmsg;
  }
  // Not sure about the following line ??
  Header("Location: http://mysite.com/path/to/myself?step=2";);
}

if ($_POST['step']=='2')
{
  ... etc...


Graham

> -----Original Message-----
> From: Stuart Felenstein [mailto:stuart4m@xxxxxxxxx]
> Sent: 22 October 2004 21:55
> To: Brent Baisley
> Cc: php-general@xxxxxxxxxxxxx
> Subject: Re:  Redirect then error message to user
>
>
> Brent - Thank you I will try that method.
>
> Can you elaborate more on below. I take it to mean you
> have one page/script that your pages are going to do
> all the checks.
>
> This form is 5 pages long.  So I chose session
> variables just to keep it neat and "maybe", more
> secure.
>
> Stuart
> --- Brent Baisley <brent@xxxxxxxxxxxx> wrote:
>
> > I design all my pages so that "one" file handles
> > display, edit,
> > validation and save. Then I don't have to worry
> > about going back and
> > forth between pages, doing redirects or retaining
> > data through session
> > variables. Most important, the user doesn't lose
> > what they already
> > entered just because they missed a field.
> >
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux