0

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 toggle 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?

1

1 Answer 1

0
if($list1ID == $list2ID) {
    mysql_query("INSERT INTO products(price) SELECT value FROM products_fieldvals WHERE fieldval_id='4'");
}
1
  • Is the way I wrote the $_POST function gonna work? OR what do I do for that?
    – user787885
    Jul 11, 2011 at 13:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.