Conditional Statements Troubleshooting
Posted: Tue Jul 12, 2005 11:08 pm
Alright, so I'm off to writing my first useful PHP application. Its a user registration system that uses the same php file to display the user control panel or the registration fields and agreements (yes, its inspired by the way phpBB works). Its the first time I've tried conditional statements on my own...and I've screwed up already. Here's my code:
And to see what its doing, check out
http://www.zorasdomain.com/usercp.php
Basically, what it is supposed to echo is placeholders to check my conditional statements so I can plug in those elements later. It is supposed to check $mode to decide what the user needs (registration or control panel). Then, if it decides that $mode="register", it is supposed to check if $coppa="yes". If it does, it should display the registration form. If it doesn't, then it should display the COPPA agreement. However, its displaying both (I'm using placeholders for the agreement and the form, if you hadn't caught that above). Does anyone know what I'm doing wrong here? Feel free to educate me a bit, as I'm still a complete PHP noob.
Also, clicking the above link shouldn't display anything, as $mode and $coppa wouldn't be assigned a value. No matter what they equal it seems, both conditions are output.
Code: Select all
<?php
if ( $mode="e;profile"e; )
{
echo "e;їProfile Control Panel Placeholder]"e;;
}
if ( $mode="e;register"e; and $coppa<>"e;agree"e; )
{
echo "e;їCoppa Agreement Placeholder]"e;;
}
if ( $mode="e;register"e; and $coppa="e;agree"e; )
{
echo "e;їRegistration Form Here]"e;;
}
?>http://www.zorasdomain.com/usercp.php
Basically, what it is supposed to echo is placeholders to check my conditional statements so I can plug in those elements later. It is supposed to check $mode to decide what the user needs (registration or control panel). Then, if it decides that $mode="register", it is supposed to check if $coppa="yes". If it does, it should display the registration form. If it doesn't, then it should display the COPPA agreement. However, its displaying both (I'm using placeholders for the agreement and the form, if you hadn't caught that above). Does anyone know what I'm doing wrong here? Feel free to educate me a bit, as I'm still a complete PHP noob.
Also, clicking the above link shouldn't display anything, as $mode and $coppa wouldn't be assigned a value. No matter what they equal it seems, both conditions are output.