Change php variable value through average queries

-3

I need to change the value of the variable of a function according to the resolution of the screen (when reducing the screen the value will have to be updated immediately). Is it possible to change this value through CSS media queries?

That is, something like this with css:

@media only screen and (max-width: 1065px) {
    $variavel = 3;
}

@media only screen and (max-width: 769px) {
    $variavel = 2;
}

To retrieve the value in php:

catalogo($variavel) ;

Is there any way to do this?

Thank you

    
asked by anonymous 26.01.2016 / 17:38

1 answer

2

PHP is a Server Side language and CSS is a Client Side language.

There is no direct communication between them. However, through AJAX it is possible to perform some communication between the two.

I would advise you to read about AJAX, here is a good link to get link

However, it tells us what you really want to do so we can tell you a better way, I think AJAX will be too complex for what you need ..

    
27.01.2016 / 15:24