acctman Posted July 28, 2007 Share Posted July 28, 2007 The cookie data is not being displayed in the register.html file, is there something wrong with my coding? <?php /* File refer.php www.domain.com/refer.php?m=UserName */ $rmbuser = $_REQUEST['m']; if (isset($_COOKIE["rmbreferral"])) header ("Location: http://www.domain.com/register.html"); else setcookie ("rmbreferral", $rmbuser, strtotime("+30 days")); header ("Location: http://www.domain.com/register.html"); ?> I added this to the register.html file. Referred By:<input type=text name=edit[ref_by] size=30 value='<? echo $_COOKIE['rmbreferral']; ?>'> Quote Link to comment Share on other sites More sharing options...
Caesar Posted July 28, 2007 Share Posted July 28, 2007 Unless you've modified Apache to do so, the server isn't going to parse PHP syntax inside an HTML file, as PHP code. Quote Link to comment Share on other sites More sharing options...
zipp Posted July 28, 2007 Share Posted July 28, 2007 AKA, save the file as a .php and not a .html. You will need a php server/apache to view the file. I use wamp5, its great. php, apache, and mysql. heres a link to the home page http://www.wampserver.com/en/ Quote Link to comment Share on other sites More sharing options...
acctman Posted July 28, 2007 Author Share Posted July 28, 2007 i'm using a linux server editing an exisiting register.html file, i'm looking at the file now and see that its parsing php coding in other locations like this <? global $countries; foreach ($countries as $key => $value) echo "<option value='".$key."' ".($en['country'] == $key ? ' selected' : '').">".htmlentities($value['name'],ENT_QUOTES)."</option>"; ?> so i'm thinking is my coding correct? Quote Link to comment Share on other sites More sharing options...
corbin Posted July 28, 2007 Share Posted July 28, 2007 Where are these cookies being set? And try viewing the source via a web browser on the page... If you can see your php source and it's going through a webserver, then it's not being parsed.... Quote Link to comment Share on other sites More sharing options...
acctman Posted July 29, 2007 Author Share Posted July 29, 2007 if i put <? echo $_COOKIE['rmbreferral']; ?> outside of the input value property it shows the referral it just wont parsing if i put it as <input type=text name=edit[ref_by] size=30 value='<? echo $_COOKIE['rmbreferral']; ?>'> any idea why? Quote Link to comment Share on other sites More sharing options...
acctman Posted July 29, 2007 Author Share Posted July 29, 2007 is 'echo' and print_r the only way to display the cookie data? Quote Link to comment Share on other sites More sharing options...
acctman Posted July 29, 2007 Author Share Posted July 29, 2007 Solved: I had to format the coding like below. it wouldn't work if all on one line. <tr><td class=regform>Referred By:</td><td><input type=text name=edit[ref_by] size=30 value=' <? echo $_COOKIE["rmbreferral"]; ?> ' disabled></td></tr> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.