This is a discussion on session - save data within the PHP Language forums, part of the PHP Programming Forums category; Hi, I would like to enable ppl a country choice on the first page and it should be saved while ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hi,
I would like to enable ppl a country choice on the first page and it should be saved while they're resting on my site so i can pre-select it on the contact form, I tried following: [top of index.php - nothing above] <?php session_start(); // start up your PHP session! if ($_POST['country']) { $_SESSION['country']=$_POST['country']; echo "counry's been saved as: ".$_SESSION['country']; } ?> [/top of index.php - nothing above] [contact.php (where i wanna use the info)] <?php if ($_SESSION['country']) { echo $_SESSION['country']; } .... .... [/contact.php (where i wanna use the info)] it wouldn't echo anything on contacvt.php....what have i forgotten/overseen? Help apprecaited! Thanks very much! roN |
|
|||
|
"shawnews" <example@example.com> wrote in message
news:GjEdh.438300$R63.352280@pd7urf1no... > Hi, > > I would like to enable ppl a country choice on the first page and it > should be saved while they're resting on my site so i can pre-select it on > the contact form, I tried following: > [top of index.php - nothing above] > <?php > session_start(); // start up your PHP session! > if ($_POST['country']) > { > $_SESSION['country']=$_POST['country']; > echo "counry's been saved as: ".$_SESSION['country']; > } > ?> > [/top of index.php - nothing above] > [contact.php (where i wanna use the info)] > <?php > if ($_SESSION['country']) > { > echo $_SESSION['country']; > } > ... > ... > [/contact.php (where i wanna use the info)] > it wouldn't echo anything on contacvt.php....what have i > forgotten/overseen? > Help apprecaited! > Thanks very much! Got it, thank you anyways, i just needed to start the session by "session_start(); " in contact.php as well :) Thanks! roN |
![]() |
| Thread Tools | |
| Display Modes | |
|
|