# Javascript / Php

- Thread: https://externals.io/message/9599
- Original archive: https://news-web.php.net/php.internals/9599
- Started by Kyle Vorster on 2004-04-28T12:37:08+00:00
- Messages: 2
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #9599 — Kyle Vorster — 2004-04-28T12:37:08+00:00

URL: https://externals.io/message/9599#9599

<?php 
function setscreen() { 
   $height = "<script>document.write(screen.width);</script>"; 
   $width = "<script>document.write(screen.height);</script>"; 
   if (($height == "640") && ($width == "480")) { 
      echo "height == 640 & width = 480"; 
   } elseif (($height == "800") && ($width == "480")) { 
      echo "2"; 
   } elseif (($height == "800") && ($width == "600")) { 
      echo "3"; 
   } elseif (($height == "1024") && ($width == "576")) { 
      echo "4"; 
   } elseif (($height == "1024") && ($width == "768")) { 
      echo "Height = 1024 & width = 768"; 
   } 
echo "Height == $height & width == $width"; 
} 
?> 
<?php setscreen(); ?> 

gives me this 

Height == 1024 & width == 768 

but the html for that is Height ==
<script>document.write(screen.width);</script> & width ==
<script>document.write(screen.height);</script> 

and i wanne work with the 1024 in php and not with the html ,, what can
i do to
run the javascript at server side and not on the client side

---

## #9600 — George Schlossnagle — 2004-04-28T12:54:21+00:00

URL: https://externals.io/message/9599#9600 · In reply to: #9599

This is not the list you're looking for.  You want to ask this question 
on php-general@lists.php.net.


George



> <?php
> function setscreen() {
>    $height = "<script>document.write(screen.width);</script>";
>    $width = "<script>document.write(screen.height);</script>";
>    if (($height == "640") && ($width == "480")) {
>       echo "height == 640 & width = 480";
>    } elseif (($height == "800") && ($width == "480")) {
>       echo "2";
>    } elseif (($height == "800") && ($width == "600")) {
>       echo "3";
>    } elseif (($height == "1024") && ($width == "576")) {
>       echo "4";
>    } elseif (($height == "1024") && ($width == "768")) {
>       echo "Height = 1024 & width = 768";
>    }
> echo "Height == $height & width == $width";
> }
> ?>
> <?php setscreen(); ?>
>
> gives me this
>
> Height == 1024 & width == 768
>
> but the html for that is Height ==
> <script>document.write(screen.width);</script> & width ==
> <script>document.write(screen.height);</script>
>
> and i wanne work with the 1024 in php and not with the html ,, what can
> i do to
> run the javascript at server side and not on the client side
>
> -- 
> 
> 
>
>
// George Schlossnagle
// Postal Engine -- http://www.postalengine.com/
// Ecelerity: fastest MTA on earth
