Forum Moderators: open
I'm trying to create a form that will submit information to one of two different pages, based on which radio box was selected.
I know it's not complete, but here's what I have so far:
<form method="post" action="1.php">
<input name="name" type="text">
<input name="email" type="text">
<textarea name="text"></textarea>
<input name="site" type="radio" value="1.php">
<input name="site" type="radio" value="2.php">
<input type="submit" value="Submit">
</form>
Any advice?
I'm trying to make it when the radio button 1.php is selected, the form will post to 1.php, not 2.php.
Conversely, when 2.php is selected, the form will post to 2.php and not 1.php.
I'm also trying to look for an elegant solution that will work without fail, even if the user has JavaScript disabled. (If that's possible.)
Thanks for any help!
<input name="site" type="radio" value="1.php">
<input name="site" type="radio" value="1.php?2">
If that works, you can test for the variable on the php page. If it's not present, do what 1.php does. If it's present, and equals 2, do what 2.php does.
Note: if you don't plan on using any other variables, you can avoid the syntax 1.php?variable=2 and just use 1.php?2 as PHP allows you to grab the contents of the posted variable via $_SERVER['QUERY_STRING'];
I've been learning so much about PHP lately, and how wonderful it is!
It's lame that a variable like submitting pages can't be changed, but I found out how I can restructure the receiving page to show differently based upon the variable.
Thus I've combined both pages into one!
Thank you so much!