Code: Select all
andCode: Select all
tags where approriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
Ok...this might get a bit complicated, but I'll do my best to keep it simple.
We're creating a dynamic news web site. I am using PHP to pull the header POST info (multiple items), putting it in a variable seperated by commas, and using it to set a cookie. The cookie is set using JavaScript so I can set a cookie in the middle of the page, rather than in the header.
Here is my code as it sits now (say POST contains 3 items, 1, 2 and 3):Code: Select all
<?
foreach ($HTTP_POST_VARS as $posted)
{
$cookie_value .= (string)$posted . ",";
}
$cookie_value = rtrim($cookie_value, ',');
echo "<script type="text/javascript">\r";
echo "<!--\r";
echo "setCookie("atshome","" . $cookie_value . "",720);\r";
echo "alert(getCookie("atshome"));\r";
echo "//-->\r";
echo "</script>\r";
?>Ok...not here comes the strange part. That code works fine in FireFox, setting the cookie to e.g. 1,2,3
In IE 6, I get the following when I go to view source:
Code: Select all
<script type="text/javascript">
<!--
setCookie("atshome","1,
3,
5",720);
alert(getCookie("atshome"));
//-->
</script>If I set a variable, say $test_value = "1,2,3" and replace the variable in the setCookie function, it works fine in both FireFox and IE.
Can anyone spot something that I'm doing wrong, or is there a quirk with IE that I need to work around?
If you want to see the code in action go to: http://home.advantechcny.com
Click on customize, select a couple of checkboxes and click submit. IE will also give an "Undertermined string constant" error, and if you view the source, you should see the same as I am getting.
Thanks for your help guys. I've had my partner look at the code as well and he can't figure anything out either.
feyd | Please use
Code: Select all
andCode: Select all
tags where approriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]