Jump to content

Echo Variables


arunpatal

Recommended Posts

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

Edited by arunpatal
Link to comment
Share on other sites

<?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
Share on other sites

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

Edited by arunpatal
Link to comment
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.