farkewie Posted November 9, 2007 Share Posted November 9, 2007 Hi i am creating a site for work, i made a login system where i stores informaton in a cookie that is set pretty much until they clear there cache. problem is i am trying to echo the cookie at the top of each page much like this page does. and it will onl echo on my index page all the pages have the same code . (i just use includes). here is the echo code. top.php <?php <div id="header-logo"> <div id="logo" class="red style3"><span class="style5">WDCS</span> <span class="style4">Townsville <span class="style8">Welcome </span><span class="style9"><?php echo $_COOKIE['fname'];?></span><br> <br /> </span> </div> ?> and this is what each page looks like page.php <?php $url = "http://".$_SERVER['HTTP_HOST']."/mobiles/"; if (!isset($_COOKIE['username'])) { header ("Location: http://".$_SERVER['HTTP_HOST']."/mobiles/login.php"); exit; } ################################## ##### DO NOT MOVE ####### include ($url."sql.php"); include ($url."top.php"); include ($url."left.php"); ################################## ?> <!--Start body content--> <!--end body content--> <? ################################## ##### DO NOT MOVE ####### include ($url."footer.php"); ################################## ?> Link to comment https://forums.phpfreaks.com/topic/76687-echo-cookie-value-only-works-on-1-page/ Share on other sites More sharing options...
SammyGunnz Posted November 9, 2007 Share Posted November 9, 2007 In top.php, how exactly are you echo'ing out that html?...Because that html is wihin the PHP tags....then you have your cookie variable within another set of php tags. Link to comment https://forums.phpfreaks.com/topic/76687-echo-cookie-value-only-works-on-1-page/#findComment-388251 Share on other sites More sharing options...
farkewie Posted November 9, 2007 Author Share Posted November 9, 2007 Sorry that was just a sampleof the code. i didnt want to paste a massive chunk.i added the php tage for code highlighting (most people find it easier to read.) herer is the whole thing: top.php <?php $url = "http://".$_SERVER['HTTP_HOST']."/mobiles/";?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta name="Description" content="Information architecture, Web Design, Web Standards." /> <meta name="Keywords" content="your, keywords" /> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <meta name="Distribution" content="Global" /> <meta name="Author" content="Erwin Aligam - [email protected]" /> <meta name="Robots" content="index,follow" /> <title>Telstra WDCS - Townsville</title> <link href="<?php echo $url ?>inc/style.css" rel="stylesheet" type="text/css" /> <style type="text/css"> <!-- .style3 {color: #FF0000} .style4 {color: #CC0001} .style5 {color: #000000} .style8 { color: #000000; font-size: 14px; } .style9 {font-size: 14px} #form { position:absolute; left:612px; top:63px; width:292px; height:42px; z-index:1; } --> </style> </head> <body> <!-- wrap starts here --> <div id="form"> <form action="<?php echo $url ?>contacts.php" method="get" id="search"> <label> <input type="text" name="q" id="q" /> <input type="submit" name="button" id="button" value="Search" /> </label> </form> </div> <div id="wrap"> <!-- header --> <div id="header"> <span id="slogan">Always customer first... </span> <!-- tabs --> <ul> <li id="current"><a href="<?php echo $url;?>index.php"><span>Home</span></a></li> <li><a href="http://vus842.rr.in.telstra.com.au/conen/" target="_blank"><span>Conan</span></a></li> <li><a href="<?php echo $url;?>phones_db.php?page=makes"><span>Phones</span></a></li> <li><a href="http://a00000551004620/wdcs/index.php" target="_blank"><span>WDCS</span></a></li> <li><a href="http://easenetprod.in.telstra.com.au/mobiles/home/prodserv/msgcomms/s0index.htm" target="_blank"><span>Easenet</span></a></li> <li><a href="http://www.in.telstra.com.au/ism/mvcstsv/index.asp" target="_blank"><span>MVCS</span></a></li> <li><a href="http://iexfmv01.in.telstra.com.au/agentops/loginSetup.do" target="_blank"><span>Contacts </span></a></li> </ul> </div> <div id="header-logo"> <div id="logo" class="red style3"><span class="style5">WDCS</span> <span class="style4">Townsville <span class="style8">Welcome </span><span class="style9"><?php echo $_COOKIE['fname'];?></span><br> <br /> </span> </div> </div> Link to comment https://forums.phpfreaks.com/topic/76687-echo-cookie-value-only-works-on-1-page/#findComment-388259 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.