Tuesday, 13 March 2018

Assign javascript value to php variable

I'm trying to check screen width and assign it to a php variable to do some if else statements. This is what I got.





$widthChecked = "";
echo $widthChecked;
?>



This works perfectly. But when I try to echo something based on the mobileFormReady value, it doesnt echo.



This is what im trying to get to work.



$widthChecked = "";
if($widthChecked == "22"){
echo 'this page is under 767 pixels';
}

else if($widthChecked == "55"){
echo 'this page is OVER 767 pixels';
}
else{
echo 'NOT WORKING YET';
}


I think its a string integer issue. But I cant seem to figure it out. Can you guys please help me? Thanks a lot.

No comments:

Post a Comment

casting - Why wasn't Tobey Maguire in The Amazing Spider-Man? - Movies & TV

In the Spider-Man franchise, Tobey Maguire is an outstanding performer as a Spider-Man and also reprised his role in the sequels Spider-Man...