Re: Redirect then error message to user

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

 



You can pass the error in the redirect URL:
header("Location: http://www.xxxxxx.com/page1.php?errmsg=You missed some stuff")


On your main page you just check if there is an errmsg to be displayed:
if(isset($_GET['errmsg'])) {
	echo $_GET['errmsg'];
}

That a simplified version obviously. But that's the concept.

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.

On Oct 22, 2004, at 3:58 PM, Stuart Felenstein wrote:

The only problem I'm having here is that if a user
goes backwards, the error from the session variable
will show up.  I put an unset $...... underneath the
echo but that seems to have no effect.


Stuart --- Stuart Felenstein <stuart4m@xxxxxxxxx> wrote:

See below:
--- Jason Wong <php-general@xxxxxxxxxxxx> wrote:


What are you trying to do here?
Is 'Page1' == TestMulti4a.php?
Are you trying to display $_SESSION['er'] as set
in
Page2?
If so why are you assigning $_POST['er'] to
$_SESSION['er']? All you need to
do is echo $_SESSION['er'].


Yes Page1 - TestMulti4a So slightly changed and I thought it was working, seems TestMulti4a (page1) displays the error when I go to it directly (before input)

So on Page2 I have:
else
   {
   $_SESSION['oops'] = "Use all 3 fields to set a
skill";
      header("Location:
http://www.lurkingforwork.com/TestMulti4a.php"; );
    exit;
   }

Page1:
<?php print $_SESSION['oops'] ?>

I even logged out of the session, thinking I was now
carrying it through the session.

Stuart




Jason Wong -> Gremlins Associates ->
www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet
Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
A witty saying proves nothing.
		-- Voltaire
*/

--
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



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


--
Brent Baisley
Systems Architect
Landover Associates, Inc.
Search & Advisory Services for Advanced Technology Environments
p: 212.759.6400/800.759.0577

--
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