I have what should be a very simple question. I am using the following simple PHP if/else statement. When nomobile is not defined or not equal to “true”, then the javascript shown below should execute. If it is equal to true, then it should not execute. However, the javascript is executing even when nombobile=true. There is probably a minor typo that is messing everything up, but I am driving myself crazy trying to find what is wrong and can’t figure it out.
<?php
if ($_GET["nomobile"]!="true")
{echo '
<script type="text/javascript">
if (screen.width <= 699) {
document.location = "http://www.heliohost.org/m/";
}
</script>';}
else {} ?>
Could it be that you’re not checking if the $_GET value is set? Taking this statement of yours and converting it into code should produce this:
There might be issues happening if it’s not set.
I hope that helps!