Form and session variables

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
amarquis
Forum Newbie
Posts: 10
Joined: Fri Dec 19, 2003 3:53 pm
Location: Switzerland

Form and session variables

Post by amarquis »

Hi all !

I have a multiple pages form and I POST my values form page to page using method="POST" and on the next page I register all my fields as session variables using $_SESSION['FIELD1'] = $FIELD1;

It seems that once a value is passed as a session variable I cannot change it anymore ? What I would like to is that users could resbmit a page of the form, having changed some fields and that these values would now be taken and not the first ones.

How could I do that ?

Thanks for your support to a PHP rookie !! :roll:
User avatar
Bill H
DevNet Resident
Posts: 1136
Joined: Sat Jun 01, 2002 10:16 am
Location: San Diego CA
Contact:

Post by Bill H »

Session variables can be changed at will. Having done:

Code: Select all

<?php
$_SESSION['FIELD1'] = $FIELD1; 
?>
You can at any time or in any subsequent script just:

Code: Select all

<?php
$_SESSION['FIELD1'] = $FIELD5; 
?>
amarquis
Forum Newbie
Posts: 10
Joined: Fri Dec 19, 2003 3:53 pm
Location: Switzerland

Post by amarquis »

Mmh... I solved my problem ! :wink:

But no this didn't work for me since I use POST method I had to use

Code: Select all

<?php
$_SESSION['FIELD1'] = $_POST['FIELD1'];
?>
Otherwise my values were not updated...

But thanks anyway !
Post Reply