Jump to content

Two different form action based upon a variable?


vozzek

Recommended Posts

Hi all,

 

Is it possible to have a form choose from two different possible actions (i.e. loading two different pages) based upon the value of a variable in php?

 

For example, let's assume my form looks like this:

 

<form ACTION="https://mywebsite.com/checkoutA.php" method="POST" name="pay_form" id="pay_form" onSubmit="return chkPayForm();" style="margin:0;">

 

Let's assume I have a variable called $total.  If $total>0 I would like the form to process onto the page checkoutA.php

 

But if the $total is not greater than zero, I would like the form to process onto the page checkoutB.php

 

How would I go about this?  Would I need to know the value of $total before the page gets to the html <form> code, and then optionally echo each possible outcome?  Or is there an easier way?

 

Thanks in advance, as always.

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.