How to merge Javascript with PHP

Asked

Viewed 23 times

0

I use PHP, when necessary, I use Javascript, but the basics of the basic.

I need to capture the screen resolution of the client, I believe it is not possible in PHP because a client-side language is required (Javascript).

I’m not sure how to merge this being that my file is PHP, a function file, so I need to inject javascript in the middle of the function in PHP and pass the value of the variable in javascript to the variable in PHP, then these PHP variables enter an array.

Follow what I’m trying to:

echo "<script>
          var width = screen.width;
          var height = screen.height;
      </script>";  
$width_screen = "<script>width</script>";
$height_screen = "<script>height</script>";
  • I think your question refers to a common problem that already has an answer in the question I have indicated. If you still have doubt say, or edit/ask a more specific question.

  • @Sergio, you’re right, thank you and we can disregard this question of mine.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.