if statement problem!
Posted: Thu Jan 08, 2004 10:48 pm
hi guys,
I am having a small problem right now...
This is how my current layout for my php page is, I will ask my question after the code:
[syntax=php]<?php
require 'db.php'; //database connect script, includes session_start() and $logged_in.
if($logged_in == 1) {?>
//LOTS OF COMMANDS HERE IF THE USER IS LOGGED IN
}
//NECESSARY HTML CODE FOR USERS THAT ARE BOTH LOGGED IN AND NOT LOGGED IN
<?php if($logged_in == 1) {?>
Welcome <?php echo $_SESSION['username'];?></strong></span>! Now that you are logged in, you are able to choose from the following:
//MEMBERS PAGE STUFF
<?php
} else { // if form hasn't been submitted
//LOGIN TEXTFIELDS
?>[/syntax]
So my question is this:
notice how I have two of the same if statements following one another (if($user_logged_in == 1))...I need the stuff in between both if statements to run whether the user is logged in or not, but it does not run the second if statement due to the fact that it has an identical one above it...IS THERE anything I can do to fix this? Or to somehow skip the necessary HTML in between?
Thanks guys!
-bumple
I am having a small problem right now...
This is how my current layout for my php page is, I will ask my question after the code:
[syntax=php]<?php
require 'db.php'; //database connect script, includes session_start() and $logged_in.
if($logged_in == 1) {?>
//LOTS OF COMMANDS HERE IF THE USER IS LOGGED IN
}
//NECESSARY HTML CODE FOR USERS THAT ARE BOTH LOGGED IN AND NOT LOGGED IN
<?php if($logged_in == 1) {?>
Welcome <?php echo $_SESSION['username'];?></strong></span>! Now that you are logged in, you are able to choose from the following:
//MEMBERS PAGE STUFF
<?php
} else { // if form hasn't been submitted
//LOGIN TEXTFIELDS
?>[/syntax]
So my question is this:
notice how I have two of the same if statements following one another (if($user_logged_in == 1))...I need the stuff in between both if statements to run whether the user is logged in or not, but it does not run the second if statement due to the fact that it has an identical one above it...IS THERE anything I can do to fix this? Or to somehow skip the necessary HTML in between?
Thanks guys!
-bumple