RE: Lost session variables still confounding me

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

 



>>Page 1:
>>//Start the Session - begin Block
>>@session_start();
>><form method="POST" name="form1" action="Page2.php">
>><input name="ListingName" type="text" id="ListingName"
>>/>

Is it necesarry to start the session here? Maybe it is if they have to
be logged in or something
Normally I only start the session when I indeed can assign some session
variables in the same page

>>Page 2:
>>//Start the Session - begin Block
>>@session_start();
>>//Set the session variable, input on Page 1
>>$_SESSION['f1a'] = $_POST['ListingName'];

//Set the session variable, input on Page 1
session_register('f1a');
$_SESSION['f1a'] = $_POST['ListingName'];


>>Page 3:
>>//ON this page, I check that f1a still exist using an
>>echo - generally it does unless :

>>//Start the Session - begin Block
>>@session_start();
>>if (count($myarray) > 5) {
>>$_SESSION['arrayerr'] = "you have selected too many industries";
header ("Location: Page2.php"); exit; } If the validation above passes,
no problem. But if it >>doesn't, once it redirects, the session variable
, f1a is bye bye.


Why do you put the error message in a session variable?
Also you will get an error (header already sent) I suppose since you
first send some text and then do a header.
Also if you rederict to page2.php, at the beginning of that page you set
$_SESSION('f1a')= $_POST['ListingName'];
Since there are no POST values (you are coming from page3)
$_SESSION('f1a') will get an empty value...
Maybe this causes the loss...

I dunno if this will help, I'm not that good at php.

Greetings,
Reinhart

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