Jump to content

Ahggg!


watagal

Recommended Posts

Can someone kindly explain the output I'm getting?

// Cookie check for returning members	echo '[U='.$_COOKIE['ri1'].']<br />';	echo '[P='.$_COOKIE['ri2'].']<br />';if (isset($_COOKIE['ri1'])) {$chkRemUserName = ($_COOKIE['ri1'] == true) ? 'checked="checked"' : '';}else						{$chkRemUserName = '';}if (isset($_COOKIE['ri2'])) {$chkRemPassword = ($_COOKIE['ri2'] == true) ? 'checked="checked"' : '';}else						{$chkRemPassword = '';}	echo '[U='.$chkRemUserName.']<br />';	echo '[P='.$chkRemPassword.']<br />';

FireFox Output is :[u=true][P=false][u=checked=checked][P=checked=checked]"P" should be:[P=]if originally false ??IE Output is:[u=][P=][u=][P=]thanks, Gal

Link to comment
Share on other sites

It's best not to use true and false values for cookies, some browsers will delete a cookie with a value "false" instead of setting a cookie with that value. I'm not even sure about 1 and 0, maybe "y" and "n" or something would work better.Browsers also behave differently with cookies on localhost vs. on an internet server, IE especially. When testing with cookies, it's always better to upload your test files to a live server and access it using the full domain name. You'll get much more predictable results that way.You can also use this to see all the cookies sent by the browser:print_r($_COOKIE);It helps to view the source of that page instead of looking at the HTML output.

Link to comment
Share on other sites

Thanks JSG, changing to 'y' and 'n' appears to have fixed it for Firefox - print_r($_COOKIE) displays "Array ( [ri1] => y [ri2] => y [i2] => e10adc3949ba59abbe56e057f20f883e [i1] => wg )".In IE, print_r($_COOKIE) displays only "Array ( )" - I'll have to wait and upload the site to my ISP to test cookies in IE.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...