Your code of
Code: Select all
// store session data
$_SESSION['data'] = 'value';
the value is going to be dynamic. It cant be set as a constant.
and by using
wont pass what ever the value becomes. probably because that value is empty.
Also by using if(isset) .
when the page reloads and checks if the select menu is set ..it WILL be. because of the saved user select 'history' function.
so when the page reloads. its 1. checking to see if the menu is set . and it will be.
then it will check for value , but its not doing it , because the value is fetched from the database.
in order to get it to fetch from database, the select menu has to be submitted again to trigger that response.
so i get an Warning that is basically telling me i have NULL values on the 'if(isset) ' menu.
If i click the submit button again, it will then go and fetch the values from database. and the Warning disappears.
the problem is, i dont want that warning on my page at all , ever.
I'm wondering if somebody has done this before and found a way around it.
Because when the page reloads, it will be looking for those 'quantity' values. and they wont exist because where the variables are set in the select menu to the database as
Code: Select all
if(isset($_POST['product_main']))
{
$sql = "SELECT quantity, baseprice, weight FROM b1_product WHERE id = " . $_POST['product_main'];
$res = mysql_query($sql);
$row = mysql_fetch_assoc($res);
$quantity = $row['quantity'];
$baseprice = $row['baseprice'];
$weight = $row['weight'];
}
?>
the page reloads and then finds that = hey, there is a NULL value in $row. Because the submit button hasnt triggered to fetch that info from database.
that's why, when the warning pops up, ..you can click the submit button and the warning disappears.
Its as if im neediong constant variables that are determined by dynamic user selection.
thats my question, not the 101 on SESSION : )