Hi Guys,
I'm trying to set a value via the select/option drop downs in php. I have something very similar working for buttons but I can't get this to work, it does nothing.
cart.php
Now what I'm expecting to happen is that the page reloads with the new delivery value when the option is changed, but nowt happens. I can get buttons to work using this method and setting hidden variables, so I don't understand why this doesn't work?
edit: I've tried with method=post and $_POST['delivery'] as well
I'm trying to set a value via the select/option drop downs in php. I have something very similar working for buttons but I can't get this to work, it does nothing.
cart.php
PHP:
<?php
$delivery_option = 6;
if(isset($_GET['delivery'])) {
switch($_GET['delivery']) {
case "royal":
$delivery_option = 6;
break;
case "free":
$delivery_option = 0;
break;
}
}
echo "<form action=\"cart.php\" method=\"get\">\n";
echo " <select name=\"delivery\">\n";
echo " <option value=\"royal\">Royal Mail - £6</option>
echo " <option value=\"free\">Local Delivery - £0</option>
echo " </select>\n";
echo "</form>\n";
echo "<p>Delivery Price: £$delivery_option</p>\n";
?>
Now what I'm expecting to happen is that the page reloads with the new delivery value when the option is changed, but nowt happens. I can get buttons to work using this method and setting hidden variables, so I don't understand why this doesn't work?
edit: I've tried with method=post and $_POST['delivery'] as well
Last edited: