newnewbie Posted March 18, 2010 Share Posted March 18, 2010 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! Link to comment https://forums.phpfreaks.com/topic/195740-if-else-in-html-table-ignores-else-statement/ Share on other sites More sharing options...
nafetski Posted March 18, 2010 Share Posted March 18, 2010 Change if($page_title = "My Stories") { to if($page_title == "My Stories") { Link to comment https://forums.phpfreaks.com/topic/195740-if-else-in-html-table-ignores-else-statement/#findComment-1028309 Share on other sites More sharing options...
newnewbie Posted March 18, 2010 Author Share Posted March 18, 2010 The fixes are always so simple. The operator often so inept! I hope I get good at this some day. Thank you for taking a dump to help me out Link to comment https://forums.phpfreaks.com/topic/195740-if-else-in-html-table-ignores-else-statement/#findComment-1028316 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.