Re: Validation and session variables

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

 



Yes the session variables are set with $SESSION[''}.
The way it works is the variable gets set on the
follwing pages:

So, example on page 1:
I have this user input field: 
<td width="172"><input name="ListingName" type="text"
id="ListingName" maxlength="20" /></td>

On the following page (page 2):
$_SESSION['f1a'] = $_POST['ListingName'];

And all the pages follow the same method.  Inputs on
page 2 are $_SESSION[''] = $_POST['']; on page 3.

I did try putting the session_start() at the top of
the page.  Didn't seem to make any difference.

Just to show the validation code (and it's from a
class):

<?php
require_once("WA_ValidationToolkit/WAVT_Scripts_PHP.php");
?>
<?php
require_once("WA_ValidationToolkit/WAVT_ValidatedForm_PHP.php");
?>
<?php 
if ($_SERVER["REQUEST_METHOD"] == "POST")  {
  $WAFV_Redirect = "";
  $_SESSION['WAVT_Page1'] = "";
  if ($WAFV_Redirect == "")  {
    $WAFV_Redirect = $_SERVER["SCRIPT_NAME"];
  }
  $WAFV_Errors = "";
  $WAFV_Errors .=
WAValidateAN(((isset($_POST["ListingName"]))?$_POST["ListingName"]:"")
. "",true,true,true,true,"",true,1);

  if ($WAFV_Errors != "")  {
    PostResult($WAFV_Redirect,$WAFV_Errors,"Page1");
  }
}
?>
if ($_SERVER["REQUEST_METHOD"] == "POST") {
 $url = "Page2.php";
 Header("Location: $url");
}
?>

So, for every page I add validation too, I can see at
the end from the printout, that the variables are
gone, missing .

Stuart


--- Ligaya Turmelle <lig@xxxxxxxx> wrote:

> Without seeing the code:
> Try putting session_start() at the VERY beginning. 
> Also try having the 
> action go to the page itself ($PHP_SELF or putting
> in the path).  Is the 
> session variables being set using $SESSION['']?
> 
> Respectfully,
> Ligaya Turmelle
> 
> 
> Stuart Felenstein wrote:
> > Having some odd behaviour. 
> > First , let me mention this is a multi page form
> using
> > session variables. (This might be important)
> > 
> > So I am doing a page by page validation, and have
> > tried putting the code before session_start or
> after. 
> > Either way my session variables are getting lost.
> > 
> > Now in order to do my validation on the same page,
> I
> > have set form action to nothing action=""
> > And upon sucess of happy validation added this
> code:
> > 
> > if ($_SERVER["REQUEST_METHOD"] == "POST") {
> >  $url = "success.php";
> >  Header("Location: $url");
> > }
> > ?>
> > 
> > The page progresses correctly but it seems the
> > variables are gone.  
> > Sound like it makes sense ? Any suggestions or
> ideas.
> > 
> > Thank you,
> > Stuart
> > 
> 
> > -- 
> 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