Jump to content

PHP if then with a variable in an HTML table


newnewbie

Recommended Posts

I am trying to learn how to use a php variable in an html table.  Somewhere I read that you can "move in and out of" php code in the if else code, since php can only display a variable that is within php code.  My "if else" code is in an html table.  I don't get errors, but the button that should be grey (stories) remains blue (and an html rollover).  I want the button to be grey (and only grey) if the page title is "My Stories."  I hope this explains.  I have only included one row of the table.  Haven't dont the rest, 'cause I can't get it right!  Here is my code:

 

<tr>

  <td><a href="file:///C|/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs/site/stories.php">

 

<?php

$page_title == "My Stories";

// Beginning of if else to set button

 

    if($page_title == "My Stories") {

?>

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

<?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

}

?>

 

Thanks in advance and pardon my ineptness!

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.