Re: Applying the elseif and switch statement

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



You are resetting the variable to simple so it will always default to 
simple.  Change the variable name $mean1, $mean2, $mean3

Gab Teo wrote:
>
> Hello,
>
> I created a page that will enable users to go to the page of the item 
> they chose as mean with their passcode (username and password),  and I 
> used the elseif statement and the switch statement.
>
> 1. For  the elseif statemnet, the output seems to be the same as it 
> take me to:  header("Location:ordinarily.php");
> irrespective of the mean chosen
> 2.  And again for  the switch statemnet, the output seems to be the 
> same as well, it take me to:   header("Location:simple.php");
> irrespective of the mean chosen
>
>
> can anyone figure out what I need to put right
> Thanks,
> Gab
>
> <?php
> if (!empty($_POST[Submit]))
> {
> include ("databaseconnect.php");
> $username=$_SESSION[12345];
>
> $page=mysql_query("SELECT * from mean where mean='$mean'");
>
> if(mysql_num_rows($page)==0)
> echo"<ul><font color=red><b>Not available</b></font></ul>";
>
>
> $mean= "ordinarily";
> $mean = "major";
> $mean = "simple";
>
>    elseif ($mean = "ordinarily")
>    {
>    header("Location:ordinarily.php");
>   }
>    elseif ($mean = "major")
>    {
>    header("Location:major.php");
>   }
>   elseif ($course = "simple")
>    {
>    header("Location:simple.php");
>   }
> else
> echo"Rgister for mean";
>    }
> }
>
>
> ?>
>
> The switch statement
>
>
> <?php
> if (!empty($_POST[Submit]))
> {
> include ("databaseconnect.php");
> $username=$_SESSION[12345];
>
> $page=mysql_query("SELECT * from mean where mean='$mean'");
>
>
> if(mysql_num_rows($page)==0)
>
> echo"<ul><font color=red><b>Not available</b></font></ul>";
>
> $mean= "ordinarily";
> $mean = "major";
> $mean = "simple";
>
> switch ("$mean")
>  {
>    case "ordinarily" :
>    header("Location:ordinarily.php");
>    break;
>    case "major" :
>    header("Location:major.php");
>    break;
>    case "simple" :
>    header("Location:simple.php");
>    break;
>    default :
>    echo"Rgister for mean";
>    break;
>    }
> }
>
> ?>
>
> [Non-text portions of this message have been removed]
>
> 


-------------------------------------------------
John Collins
Meetings and Mixers
Box 80461
Rancho Santa Margarita, CA 92688
c949 689 7070
john@xxxxxxxxxxxxxxxxxxxxx
http://www.meetingsandmixers.com/



[Non-text portions of this message have been removed]


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux