Jump to content

if else in html table ignores else statement


newnewbie

Recommended Posts

Hi... 

I am trying to use an html rollover in a nav table which also includes a php if else statement.  If the page is "My Stories", I want the nav button to be grey, if it is on a different page, I want the nav button to be blue.  I have inserted print statements to test this and the php codes is stopping before the "else" statement, so the button is always displayed as grey and apparantly the rest of the if else statement is being ignored.  The button is grey no matter what page it is on. This is just part of the table and I set my variable earlier in the code like this: 

 

$page_title = "Home" (or whatever page I am on)

 

Then I start the table...

 

<?php

// Beginning of if else to set button for Stories

 

    if($page_title = "My Stories") {

?>

<img src="../../_img/buttons/gry_Stories.gif" alt="My Stories" border=0>

<?php

} else {

?>   

 

  <img src="../../_img/buttons/blu_Stories.gif" border="0" alt="Stories" name="bAstories" id="bAstories" onMouseOver="MM_swapImage('bAstories','','/_img/buttons/gry_Stories.gif',1)" onMouseOut="MM_swapImgRestore()"/></a></td>

</tr> 

</table>

 

</div>

</body>

</html>

 

<?php

}

?>

 

So, it appears that I am doing something wrong jumping in and out of php to html, maybe?

Thaks to everyone for being patient with us newbies!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.