Jump to content

[SOLVED] session variables and forms


kev wood

Recommended Posts

i am trying to use session variables to register variables taken from a form.  i have never used session variables before so i am a bit unsure if i am registering the variables in the correct way.  here is my code up to now

 

<?php
session_start();
$_SESSION["dropdown"];
$_SESSION["radio"];
$_SESSION["dropdown2"];
$_SESSION["radio2"];
?>

 

i have 2 different forms on the page which go to different pages depending on the user choice.

 

i am unsure if this will register the variables i need.  i have a drop down list which is called 'dropdown' and i would like to know if what i have here will store the user choice in the session variable 'dropdown'.

 

to retrieve the variables whhich i have not started to do yet would the code on the next page be something like this

 

<?php
session_start();
$_SESSION["dropdown"] = $db;
$_SESSION["radio"] = $table;
$_SESSION["dropdown2"] = $db2;
$_SESSION["radio2"] = $table2;
?>

 

with this code i could then use $db through the next page of code to get the value of the session variable 'dropdown'

Link to comment
https://forums.phpfreaks.com/topic/129732-solved-session-variables-and-forms/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.