Ok, I'll have to try that on my next project. Unfortunately these forms were 
written by another developer and there too many variables to rename to make an 
array and not enough time on the project :-)  But for next time.

I've seen many examples of assigning values to session variables w/o forms on 
the list and online. Now should I look to set those values on the next page in 
the sequence of forms that the user is entering?

page1.php
<?php
session_start();
*** session_register("test_var");*** // Is this ok?
?>
<form action="page2.php">
<input type="text" name="test_var"></input>
<input type="submit">
</form>

page2.php
<?php
session_start();
*** $_SESSION["test_var"] = $test_var;  *** // Or is this ok?
// or $HTTP_SESSION_VARS["test_var"] = $test_var on <=4.0.6
?>
... (rest of page here)

Which of the two lines is more failsafe in terms of working every time?

Jason Wong wrote:
> On Saturday 08 June 2002 14:39, Greg Macek wrote:
> 
>>What is the best/recommended method of saving form data into session
>>variables? Currently only have to deal with regular text input,
>>checkboxes and radio buttons (no multiple selects for now). Any sample
>>code someone could throw up on the list? I've only recently begun
>>working with sessions, but I'm interested to see what I can do with
>>them. Any sort of direction on this would be appreciated. Thanks!
> 
> 
> What I do is try to put all the form elements into a single array. That way 
> you'll only have a single variable to worry about.
> 



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

Reply via email to