[SOLVED] 2 Submit Buttons in one form - HMMmmm

Hello again all. :) Shopping Cart for Custom PC configuration

QUICK INFO…

configuration.php >>> I have TWO buttons on my Form.

1.) Update Price
2.) Add to Cart

Clicking on “Add to Cart” submits the FORM method POSTS to >>> cart.php

I cant figure out how to make it so when I click the button “Update Price”
… I can get the FORM to POST back to the same page (configuration.php , not cart.php)… The reason for this is that I plan on grabing the $_POST[“Selected_Prices”] data and uploading the price at the top of the page and next to the “Add to cart” button. Of course this is just for users to make their lives easier.

Anyone have any help about this…

Let me know.

what i would do (no JS needed, and thats always better):

  • use 2 submit-buttons. (only the one clicked is submitted with the form).

<input type="submit" name="action" value="Add to card" /> <input type="submit" name="action" value="Update Price" />

  • use just one page instead of two and use something like page.php?action=configure:
    [php]<?php
    if($_GET[‘action’]==‘card’ || $_POST[‘submit’]==‘Add to card’) include(‘card.php’);
    elseif($_GET[‘action’]==‘configure’) include(‘configure.php’);
    ?>[/php]
Sponsor our Newsletter | Privacy Policy | Terms of Service