You aren't getting the value to the PHP script...  allow me to walk through
what is actually happening

$resolution = "<SCRIPT
LANGUAGE=\"JavaScript\">document.write(screen.width)</SCRIPT>";
echo "--".$resolution."--";

You have just set a variable to "<SCRIPT
LANGUAGE=\"JavaScript\">document.write(screen.width)</SCRIPT>" and then
echoed that string.  so it looks like you have

--1024--  or whatever your resolution is.  if you view source though you see
you really have

--<SCRIPT LANGUAGE=\"JavaScript\">document.write(screen.width)</SCRIPT>--

and the client browser is just interpreting that JavaScript statement

if (($resolution*1) >= 1024) {
  $resolution = "1024";
} else {
  $resolution = "800";
}
echo "**".$resolution."**";

The reason this isn't acting the way you expect is because you AREN'T saying
if ((1024*1) >= 1024 {
You are actually saying
if ((<SCRIPT
LANGUAGE=\"JavaScript\">document.write(screen.width)</SCRIPT>*1) >= 1024) {

You are not actually passing anything from JavaScript to PHP... you are just
tricking yourself  =)

Sheridan

----- Original Message -----
From: Morten Winkler Jørgensen <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, July 17, 2001 4:54 AM
Subject: Re: [PHP] Output (Urgent!)


>
> >> How you want to get a value from client side to php on the same page?
>
> Well. Actually I didn't invent the code. I just correcteded it so it
> worked on my installation. I must admit I was amazed that it somehow
> worked, but it did.
>
>
> Kind regards,
>     Morten Winkler



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to