Jump to content

Recommended Posts

Sorry if this has been touched on before but i am having problems finding a definite solution.

 

Also this may be more of a javascript issue so i do apologise if i have chosen the wrong forum to start.

 

Ok. I have a simple form where a user can enter details. What i need from this form is two seperate buttons with different actions.

 

Basically they click 'Button One' then they go with all form info to one page.

And if they click 'Button Two' then they go with all info to another page.

 

I have seen possible solutions with javascript but this will require the user to have javascript enabled.

 

So im just after advice on the best solution to this.

 

thanks for any responce this may generate.

 

Bolty2uk

Link to comment
https://forums.phpfreaks.com/topic/56217-two-actions-two-buttons-on-one-form/
Share on other sites

Case Switch is a good option, I use it with a refresh option on this page.

<?
echo "<head>";
echo "<title>Software Design</title>";
echo "</head>";
echo "<body>";
echo "<center>";
echo "<form method=GET name=form1 action='$PHP_SELF'>"; 
echo  "<input type=submit name=cmd value='Yes'>";
echo "<input type=submit name=cmd value='Now'>";
echo "</form>";
echo "</center>";
echo "</body>";
echo "</html>";

Function RedirectPage($page) {
echo "<META HTTP-EQUIV='REFRESH' CONTENT='0; url=".$page."'>";
}

switch($_REQUEST['cmd']){
case "Yes";
RedirectPage('yes.php');
break;
case "No";
RedirectPage('no.php');
break;
  }
?>

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.