arunpatal Posted November 24, 2012 Share Posted November 24, 2012 Hello everyone, I have a file call config.php which look like this (i can change value to yes and no) <?php $header_toping = 'yes'; ?> now there is file call header.php which look like this <style type="text/css">#Layer1{background-color: #FFAD5B;}</style> <?php require 'config.php'; $topping = '<div id="Layer1" style="position:absolute;text-align:center;left:0px;top:0px;width:100%;height:33px;z-index:0;" title=""> </div> </br> </br>'; ?> <table id="header_table"> <td id="header"> TEXT </td> </table> <table id="header_menu"> <!--You can edit menu here--> <td> <a href="index.php">HOME</a> · <a href="products.php">PRODUCTS</a> · <a href="#">Contact</a> </td> </table> How can i echo $topping variable in header.php page by selecting the value yes in confing.php ??? and if i select no then it should not echo the $topping Link to comment https://forums.phpfreaks.com/topic/271108-echo-variables/ Share on other sites More sharing options...
50r Posted November 24, 2012 Share Posted November 24, 2012 <?php require("config.php"); $topping = "<div id='Layer1' style='position:absolute;text-align:center; left:0px;top:0px;width:100%;height:33px;z-index:0;' title=''> </div>"; $topping .= "</br></br>"; if($header_toping = "yes"){ echo $topping; }else{ echo ""; } ?> then here put your html Link to comment https://forums.phpfreaks.com/topic/271108-echo-variables/#findComment-1394758 Share on other sites More sharing options...
arunpatal Posted November 24, 2012 Author Share Posted November 24, 2012 <?php require("config.php"); $topping = "<div id='Layer1' style='position:absolute;text-align:center; left:0px;top:0px;width:100%;height:33px;z-index:0;' title=''> </div>"; $topping .= "</br></br>"; if($header_toping = "yes"){ echo $topping; }else{ echo ""; } ?> then here put your html I tried it but it just echo $topping when i set no in config.php like this <?php $header_toping = 'no'; ?> It still print $topping Link to comment https://forums.phpfreaks.com/topic/271108-echo-variables/#findComment-1394768 Share on other sites More sharing options...
PFMaBiSmAd Posted November 24, 2012 Share Posted November 24, 2012 An equal comparison is two == or three === (depending on if you want to match values or values and types.) One = is an assignment operator. Link to comment https://forums.phpfreaks.com/topic/271108-echo-variables/#findComment-1394769 Share on other sites More sharing options...
arunpatal Posted November 24, 2012 Author Share Posted November 24, 2012 An equal comparison is two == or three === (depending on if you want to match values or values and types.) One = is an assignment operator. Thanks........... I got it Its working now Link to comment https://forums.phpfreaks.com/topic/271108-echo-variables/#findComment-1394770 Share on other sites More sharing options...
50r Posted November 24, 2012 Share Posted November 24, 2012 An equal comparison is two == or three === (depending on if you want to match values or values and types.) One = is an assignment operator. An equal comparison is two == or three === (depending on if you want to match values or values and types.) One = is an assignment operator. Thanks it was such a stupid biggner mistake. hope it helped @ arunpatal Link to comment https://forums.phpfreaks.com/topic/271108-echo-variables/#findComment-1394771 Share on other sites More sharing options...
arunpatal Posted November 24, 2012 Author Share Posted November 24, 2012 Thanks it was such a stupid biggner mistake. hope it helped @ arunpatal Hi 50r It helped me....... thanks a lot for you help and thanks to pfmabismad also Link to comment https://forums.phpfreaks.com/topic/271108-echo-variables/#findComment-1394790 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.