Update a database item with price incl/excl taxes depending on a radio button
I am making a kind of checkout form. At the top I have two radio buttons, one that should show prices without tax when clicked, and another to show prices when clicked.
<form id="f-p" method="post" action="#####">
<label for="exkl">Exkl. moms</label><input name="moms" id="exkl" type="radio"value="exkl" checked="checked"/>
<label for="inkl">Inkl. moms</label><input name="moms" id="inkl" type="radio" value="inkl"/>
</form>
Then I have prices below in tables. Those prices all come from a MySQL database. Now I can, separately, query the database for product IDs:
if($_POST['moms'] == "inkl") {
$inkl_query ="SELECT `product_id` FROM `######products_fieldvals` WHERE `fielddef_id`=4";
$iresult = mysql_query($inkl_query);
but I want to cycle through and compare product IDs between two tables, and if they match, to isert the price for that item from the first table into the second one, and to togg开发者_如何学JAVAle back for the other radio. How can I do this? I want to use:
if($list1ID = $list2ID) {
INSERT INTO products(price)
SELECT value FROM products_fieldvals WHERE fieldval_id="4",
}
but that isn't working. Can someone please help?
if($list1ID == $list2ID) {
mysql_query("INSERT INTO products(price) SELECT value FROM products_fieldvals WHERE fieldval_id='4'");
}
精彩评论