Hi, all.
Really new on php!!
I want to implement one function which could get the price depending on different size and calculate the total price.
So i made foo.php and bar.php. Which people could choose the size and the price in foo.php and want to pass which they choose to the bar.php. Got stuck there.
Here is my foo.php form code:
<form name="choosesize" method="get" action="bar.php">
<p>Choose Size / Price</p>
//$sizeLp is the item's Large size price
<input type="radio" name="sizeL" value="<?php echo $sizeLp; ?>">Price(L): <?php print($sizeLp);?></input><br/>
//$sizeSp is the item's small size price
<input type="radio" name="sizeS" value="<?php echo $sizeSp; ?>">Price(S): <?php print($sizeSp);?></input><br/><br/>
<input type="submit" value="Submit"></input>
</form>
Here is my bar.php code:
if(isset($_GET["size"]) && !empty($_GET["size"]))
{
switch ($_GET["size"])//"size is the radio button name"
{
case "sizeL"://sizeL is the first input button name
$price=$_GET["value"];//want to get the first button value
break;
case "sizeS"://sizeS is the second input button name
$price=$_GET["value"];//want to get the second button value
break;
}
}
Thanks.