Radion Button and select Page

Hi!!

I have a problem with this.

The idea is this one, The user only choose one radio button (student or teacher) and then after the login button is redirect to to the page.

if I choose student button , I enter to the student page

else

if I choose teacher button , I enter to the teacher page

but is not working. I want to know why can you help me out, thanks

this is the html

</p> 
	<label><center>Choose one: </center></label></br>
	<center><input type=radio name="login" value="s" checked>student</center>
	<center><input type=radio name="login" value="t">teacher</center>
<p>
	<center><input type="submit" name="login" value="Enter" /></center>
</p>

the php code

[php]

<?php if (isset($_GET["login"])) { if( isset($_GET['login']) =="s") { include 'student.php'; }else{ if(isset($_GET['login']) =="t") include 'teacher.php'; } } ?>

[/php]

you cannot use isset and a comparison as a single function, in this case you don’t need to as your making sure login has been set on the first if so you don’t need to do it again on the nested ifs

[php]<?php
if (isset($_GET[“login”])) {

if($_GET[‘login’] ==“s”) {
include ‘student.php’;
}elseif($_GET[‘login’] ==“t”){
include ‘teacher.php’;
}

}
?>[/php]

It work!

thanks!

this topics closed

Sponsor our Newsletter | Privacy Policy | Terms of Service