Submitting a form to a non-default URL

I have a shopping cart checkout page in which the items are listed inside of a form. There is a “quantity” field next to each item and an “update quantities” button at the bottom.

By default, the form submits the item information to a payment page. How can I have the “update quantities” button submit the form to a different url instead?

Thanks in advance.

Create two forms in the page. The one with the quantity boxes submits to the update page. The one with the pay button has the quantities in hidden fields and submits to the payment page.

I have done that in other forms, but in this situation it doesn’t work out well with my layout.

It’s basically a table with the items listed in rows, which are generated by a query. And each item row also has generated hidden fields about the item to send to the payment page.

The “quantity” fields are in a column in this table. As far as I know, I can’t wrap a form around a column… so what do I do? =/

You would need to repeat the hidden information for each form or rethink your logic. Although, what type of information is being exposed in the hidden fields? It doesn’t happen to include the price of the product or anything vital to the calculating the total cost – does it? The only data necessary to rebuilding the order on the payments page would be the product ids and quantities. Everything else should then be solved internally to avoid security holes such as; the customer changing the price of a product by posting their own price to the page.

Yes, the hidden fields do contain pricing information. However, the details of the transaction are automatically verified to ensure everything matches up correctly. If not, the customer will be told to contact support and their inadequate payment will be held.

The only way to prevent this possibility is to manually copy the details of every single item in my inventory, individually, to my account with the payment processing company. With transaction verification, this is pointless.

Anyway… so there is no way to submit a form to a different url than the one defined in the form tag, correct?

You can use JavaScript to remake the form, but it’s a really inelegant solution that can easily break. Better to handle this either with separate forms, or on the server-side (the form processor contains the logic for deciding which action to take).