Associate
- Joined
- 15 Feb 2006
- Posts
- 1,872
- Location
- hell
Hi guys
Bit of a weird issue with PHP that only seems to affect Chrome and not Firefox.
I am trying to populate the contents of a json object using PHP.If someone signs up to my site, I create a PHP session variable identifying them as a new registration. They then get redirected back to the homepage using the header function.
On the homepage I have the below script. The correct output should read {regType' : 'normal'} (which works in Firefox). In Chrome it appears as 'blank' - which is odd as that session update only happens after the echo!
Any ideas?!
Bit of a weird issue with PHP that only seems to affect Chrome and not Firefox.
I am trying to populate the contents of a json object using PHP.If someone signs up to my site, I create a PHP session variable identifying them as a new registration. They then get redirected back to the homepage using the header function.
On the homepage I have the below script. The correct output should read {regType' : 'normal'} (which works in Firefox). In Chrome it appears as 'blank' - which is odd as that session update only happens after the echo!
Any ideas?!
PHP:
<script>
dataLayer = [
<?php
// session_start();
if(isset($_SESSION['register']) && !empty($_SESSION['register']))
{
$regtype = $_SESSION['register'];
echo "{'regType' : '" . $regtype . "'}";
$_SESSION['register'] = "blank";
}
?>
];
</script>