How to pass the value screen.the width of the JS in PHP?

Hi all. Want to get screen resolution of user via JS.
Do this:
<script type='text/javascript'> document.write('screen Resolution: <b>'+screen.width+'x'+screen.height+'px.</b>'); </script>

In the end, the resolution is displayed on the screen. How can I pass values to screen in php script ?
I want to get the screen resolution of the user and add it to the database using mySQL+PHP.

How to use variables (data) from JavaScript to PHP in my case? Preferably without way to GET ?

Thank you!
March 19th 20 at 09:00
2 answers
March 19th 20 at 09:02
Solution
$.ajax({
url: 'file.php',
type: 'POST',
data: {
'width':screen.width,
'height':screen.height
},
}); 

// file.php
// $width = intval($_POST['width']);

// INSERT INTO users (screen_w, screen_h) VALUES($width, $height)
March 19th 20 at 09:04
Definitely true coders me for this beat, but I used to do that and it worked

$var = '< script type='text/javascript'> document.write('screen Resolution: '+screen.width+'x'+screen.height+'px.'); < /script>';
@Lonny62, better delete)))) - esperanza.Langosh92 commented on March 19th 20 at 09:07

Find more questions by tags JavaScriptPHP