i need help with a form were you select a radio button and then click submit … it all goes to 1 page but when you select a different radio buttons it changes what you see on the next page
if anyone understands this … then reply … any help will be appreciated … thanks
@patenaudematFeb 27.2005 — #Use <INPUT TYPE="radio"> to display your buttons, and make sure the names of the buttons from the same group are the same. Also, don't forget to set VALUE in addition to what's between the input tags. Use "checked" to indicate which is selected. Example: [CODE] <INPUT TYPE="radio" NAME="group1" VALUE="a" checked> A</INPUT> <INPUT TYPE="radio" NAME="group1" VALUE="b"> B</INPUT> [/CODE] On the server side, use $_GET or $_POST to get the value. Hope it helps!
HTML form: <i> </i><!-- top of page precedes --> <form action="redirect.php" method=post> <p>Go to: <input type=radio name=page value=1 checked>Page 1 <input type=radio name=page value=2>Page 2 <input type=radio name=page value=3>Page 3 <input type=submit name=go value="Go"> </p> </form> <!-- rest of page follows -->
redirect.php: [code=php] <?php if(isset($_POST['page'])) { $pages = array(1 => "page1.html", "page2.html", "page3.html"); if(array_key_exists($_POST['page'], $pages)) { header("Location: http://www.mysite.com/" . $pages[$_POST['page']]); exit; } } # if we fell through to here, something's wrong or user got here # without using our selection form, so display error: ?> <html> <head><title>Error</title></head> <body> <h1>Error</h1> <p>There was an error processing your request. Please contact the webmaster.</p> </body> </html> [/code]