I need that when the width of the browser is between some stipulated values, my variable $colunas
assumes different values.
I have the following code:
<?php
$largura = "<script type =text/javascript>var largura = document.body.clientWidth; document.write(largura); </script>";
echo $largura, '<br>';
$colunas = 0;
if ($largura > 1800) {
$colunas = 4;
}
else if (($largura >= 1450) and ($largura <= 1800)) {
$colunas = 3;
}
else if($largura <= 1449){
$colunas = 2;
}
echo $colunas;
But my variable $colunas
always gets a value of 2, regardless of whether I change the width of the browser.