for example, this is my PHP code:
<?php
if($country_code == 'US')
{
header('Location: http://www.test.com');
}
else
{
header('Location: http://www.test.com/');
}
?>
I'm trying to use a Javascript code for tracking, it has to be above the </body> tag.
I have tried different ways of combining the PHP code with HTML, I have tried placing the HTML separately below the PHP also, one example:
<html>
<head></head>
<body>
<?php
?>
<script></script>
</body>
</html>
The furthest I got was, it tracked the click but it didn't redirect giving me this error:
`Warning: Cannot modify header information - headers already sent by`
Will appreciate any suggestions and help, thank you!
headerif you've already started to output the document, you'd have to use a different method for the redirect (i.e. JavaScript'swindow.location.href).$country_codecome from?