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.

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.