bolty2uk Posted June 19, 2007 Share Posted June 19, 2007 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 Quote Link to comment https://forums.phpfreaks.com/topic/56217-two-actions-two-buttons-on-one-form/ Share on other sites More sharing options...
jvrothjr Posted June 19, 2007 Share Posted June 19, 2007 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; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/56217-two-actions-two-buttons-on-one-form/#findComment-277669 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.