i'm making a registration form.there is a different registration page for students and teachers.so on step 1 there is a drop down menu which lets the user choose if he/she is a teacher or a student.but im stuck at how i can use that information to pass them on to the right page.
how i do pass users to different pages?
Just send both to forward.php and in forward.php use this code:
I hope that works. And if you want to show a message that the user is being redirected to the teacher/student page you can use HTML to redirect like this:
Hope that helps. Please ask if you have any questions.
Last edited by rvec on Wed Apr 02, 2008 1:04 am; edited 1 time in total
| Code: |
|
<?php $page = $_POST['page']; header('Location:'.$page); ?> |
I hope that works. And if you want to show a message that the user is being redirected to the teacher/student page you can use HTML to redirect like this:
| Code: |
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>Your Page Title</title> <meta http-equiv="REFRESH" content="5;url=<?php echo $_POST['page']; ?>"></HEAD> <BODY> You are being redirected to the <?php if ($_POST['page'] == 'student.php') { echo 'student'; } elseif ($_POST['page'] == 'teacher.php') { echo 'teacher'; }?> page. If you are not redirected please click <a href="<?php echo $_POST['page']; ?>">here</a>. </BODY> </HTML> |
Hope that helps. Please ask if you have any questions.
Last edited by rvec on Wed Apr 02, 2008 1:04 am; edited 1 time in total
this isn't helping me.i'm using a sdrop down selection to let the user choose if they are a student or a teacher.according to that they'll be redirected to the appropriate page.
| riyadh wrote: |
| this isn't helping me.i'm using a sdrop down selection to let the user choose if they are a student or a teacher.according to that they'll be redirected to the appropriate page. |
Then you would probably use javascript. I don't know much javascript so I'll leave that to someone else, or you can look on google for something.
| riyadh wrote: |
| this isn't helping me.i'm using a sdrop down selection to let the user choose if they are a student or a teacher.according to that they'll be redirected to the appropriate page. |
something like this?:
| Code: |
| <form action="redirect.php" method="POST">
<select name="page"> <option value="student.php">Student</option> <option value="teacher.php">Teacher</option> </select> </form> |
And use the code I posted before in redirect.php . You can just use the easy 4 lines to test and see if it's what you want. You can of course change the values in the above form to the actual pages you want to redirect to.
Made a quick example of how it would look like with the 4 line code (in which I made a typo
http://www.bierkip.nl/test/1/
And the same for the longer example:
http://www.bierkip.nl/test/2/
