Jump to content

Recommended Posts

I have a multipage form, where the user progresses from one page to another in a prefixed order. Now i want to give the user the option to choose where he wants to proceed, i.e. I am trying to make the value of the <FORM ACTION =""> elements to be different.

 

Example:

 

If user selects "GO to form A" from a pulldown menu,

          then <FORM ACTION="formA.php">

If user selects "GO to form B" from a pulldown menu,

          then <FORM ACTION="formB.php">

 

Is this possible?

 

Link to comment
https://forums.phpfreaks.com/topic/54745-make-form-action-a-variable/
Share on other sites

Actually, what the OP wants can not be done directly in PHP, but would have to be done in Javascript. If the OP does not want to use Javascript, then the receiving script would need to determine what to do based on the value the user selected.

 

Ken

ok, i had a different thought in mind.  i was thinking the user would choose where he wanted to go then the form would load once the choice was submitted.

 

if($_POST['choice'] == 'foo')
{
  $formaction = 'foo.php';
} else if($_POST['choice'] == 'bar'){
  $formaction = 'bar.php';
}
//html form for choice


if(isset($_POST['choice']))
{
  //load html form
}

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.