Yeah.. Good day everyone. I'm very new to PHP, so please deal with a very newbie question.
It's regarding Javascript values...
Well, I read several old posts saying it wasn't possible. However, I would like to have my code analyzed by anyone of you.
<?
$resolution = "<script type=\"text/javascript\">document.write(screen.width)</script>";
include("header.php");
if (($resolution > 0) && ($resolution <= 799)) {
echo "This is 640x480 Resolution";
} else if (($resolution >= 800) && ($resolution <= 1023)) {
echo "This is 800x600 Resolution";
} else {
echo "This is 1024x768 Resolution";
}
include("footer.php");
echo $resolution;
?>
As you can see, I designed this script to load different code depending on the resolution.
Now... I would be 100% satisfied with the PHP-JS thing if $resolution would return a weird value.
But:
1.) My script apparently has no errors.
2.) When I do echo $resolution, I get a value! And that value is correct.
The problem is that when I change resolutions, then the script seems to follow the else case regardless of the resolution.
... But that does not happen when I use echo $resolution.
Which makes me assume perfect that there is a value in resolution! But why isn't that value working on the actual script?
Thanks!