Forum Moderators: coopster

Message Too Old, No Replies

Radio buttons

         

transmutated

1:01 am on Apr 4, 2006 (gmt 0)

10+ Year Member



I was wondering how I used a radio button as a form of navigation. Here is what I am doing...

Main page, the user selects a radio button and clicks next button. On next, php examins the button checked and sends the user to the corrisponding page. What form action do I use and how do I link each radio button to a different page?

nfs2

1:10 am on Apr 4, 2006 (gmt 0)

10+ Year Member



Say you button is called "page_one"

if (isset($_POST['page_one'])) {
header("location: page1.html");
}

Or something like that

transmutated

2:13 am on Apr 4, 2006 (gmt 0)

10+ Year Member



THat works, thanks. How do I get it to work with three different radio buttons on the same form?

Option 1 goes to page 1
Option 2 goes to page 2
Option 3 goes to page 3

I'm not sure how to use the code currently as they are all IF commands. Else breaks the page. How do I do it now?

nfs2

2:39 am on Apr 4, 2006 (gmt 0)

10+ Year Member



Maybe like this- Say your form is called "get_page" and each option is "page_one" "page_two" etc.

if (isset($_POST['get_page'])) {
if ($_POST['get_page'] == page_one) {
header("location: page1.html");
} else if ($_POST['get_page'] == page_two) {
header("location: page2.html");
}
}

and so on for each page.