radio button with multiple session values
hi there
I have a recordset loop that provides a list of quantities and prices:
prodstep1.php?PROD_ID=1
At the moment I have it working so that a session value is set based on the value of the radio button selected.
I would like to add another value to the radio button, I've managed to get this far:
<input name="priceqty" type="radio" id="price_0" value="<?php echo $row_rstPrices['price']; ?>:<?php echo $row_rstPrices['desc']; ?>" />
using a ':' as a delimiter
Can you help me please with the code that would create 2 session values from the one posted variable - priceqty, at the moment I have this on the following page:
<?php
$pieces = explode(":", priceqty);
$price = $pieces[0]; // piece1
$desc = $pieces[1]; // piece2
?>
<?php
if (!session_id()) session_start();
if($_SERVER["REQUEST_METHOD"] == "POST") {
$_SESSION["price"] = "".(([$price]))?$_POST[$price]:"") ."";
}
?>
<?php
if (!session_id()) session_start();
if($_SERVER["REQUEST_METHOD"] == "POST") {
$_SESSION["desc"] = "".(([$desc]))?$_POST[$desc]:"") ."";
}
?>
many thanks