Re: [PHP] Output (Urgent!)

2001-07-17 Thread Sheridan Saint-Michel

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

$resolution = "document.write(screen.width)";
echo "--".$resolution."--";

You have just set a variable to "document.write(screen.width)" 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

--document.write(screen.width)--

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 ((document.write(screen.width)*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]




Re: [PHP] Output (Urgent!)

2001-07-17 Thread Brad Hubbard

This discussion reflects a surprisingly common misunderstanding of client v. 
server side scripting. PHP, all processing takes place on the server. 
Javascript, all processing takes place on the client. I've seen this 
misconception with ASP v. VBscript/javascript too.

Strange you would think this would be the most basic of fundamentals.

My 2c,
Brad

-- 
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]




RE: [PHP] Output (Urgent!)

2001-07-17 Thread Adrian Ciutureanu

How do you know it worked? :)

> -Original Message-
> From: Morten Winkler Jørgensen [mailto:[EMAIL PROTECTED]]
> Sent: 17 iulie 2001 12:54
> To: [EMAIL PROTECTED]
> 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]
> 
> 

--
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]




Re: [PHP] Output (Urgent!)

2001-07-17 Thread Morten Winkler Jørgensen


>> 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]




Re: [PHP] Output (Urgent!)

2001-07-17 Thread Joseph

How you want to get a value from client side to php on the same page?
Joseph

"Orv î?÷inklÏ ²ørÏkîskî" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi Frederik
>
> Run this code. It does what you want it to.
> In your original code you compared two strings in the IF-statement.
> When the $resolution gotten from your JavaScript returned '800' it would
> have a lexical higher value than '1024' and thereby do exacely what
> you wanted it to - actually the code would always return \1024\ since
> your screen resolution would never return a string with a lexical
> lower value than '1024'.
>
> By multiplying the string '1024' by 1 you get the integervalue 1024
> (that's a trick PHP offers ;) ) which you then compare to the
> integervalue 1024.
>
> That's the trick
>
> $resolution = "document.write(screen.width)";
> echo "--".$resolution."--";
> if (($resolution*1) >= 1024) {
>   $resolution = "1024";
> } else {
>   $resolution = "800";
> }
> echo "**".$resolution."**";
>
> Venlig hilsen ha' en bra dag,
> 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]




Re: [PHP] Output (Urgent!)

2001-07-17 Thread Jason Rennie

>   $resolution = " LANGUAGE=\"JavaScript\">document.write(screen.width)";
> 
>   if ($resolution >= '1024') {
> $resolution = "1024";
>   } else {
> $resolution = "800";
>   }
> echo $resolution;
> 
> It always output 1024


At a guess becasue your mixing and matching languages.

If you got the input from a hidden field in a form (perhaps an entry
page?) then it would be possible to get the data you want.

Jason


-- 
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]




RE: [PHP] Output (Urgent!)

2001-07-17 Thread Adrian Ciutureanu

I don't think this code do what he want... You are trying to mix
client-side code with server-side code, but you can't do in that way.
The ONLY way to obtain client screen resolution into a PHP variable is
send data from client to server.

> -Original Message-
> From: Morten Winkler Jørgensen [mailto:[EMAIL PROTECTED]]
> Sent: 17 iulie 2001 12:14
> To: [EMAIL PROTECTED]
> Subject: RE: [PHP] Output (Urgent!)
> 
> 
> Hi Frederik
> 
> Run this code. It does what you want it to.
> In your original code you compared two strings in the IF-statement.
> When the $resolution gotten from your JavaScript returned 
> '800' it would
> have a lexical higher value than '1024' and thereby do exacely what
> you wanted it to - actually the code would always return \1024\ since
> your screen resolution would never return a string with a lexical
> lower value than '1024'.
> 
> By multiplying the string '1024' by 1 you get the integervalue 1024
> (that's a trick PHP offers ;) ) which you then compare to the
> integervalue 1024.
> 
> That's the trick
> 
> $resolution = " LANGUAGE=\"JavaScript\">document.write(screen.width)";
> echo "--".$resolution."--";
> if (($resolution*1) >= 1024) {
>   $resolution = "1024";
> } else {
>   $resolution = "800";
> }
> echo "**".$resolution."**";
> 
> Venlig hilsen ha' en bra dag,
> 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]
> 
> 

--
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]




RE: [PHP] Output (Urgent!)

2001-07-17 Thread Morten Winkler Jørgensen

Hi Frederik

Run this code. It does what you want it to.
In your original code you compared two strings in the IF-statement.
When the $resolution gotten from your JavaScript returned '800' it would
have a lexical higher value than '1024' and thereby do exacely what
you wanted it to - actually the code would always return \1024\ since
your screen resolution would never return a string with a lexical
lower value than '1024'.

By multiplying the string '1024' by 1 you get the integervalue 1024
(that's a trick PHP offers ;) ) which you then compare to the
integervalue 1024.

That's the trick

$resolution = "document.write(screen.width)";
echo "--".$resolution."--";
if (($resolution*1) >= 1024) {
  $resolution = "1024";
} else {
  $resolution = "800";
}
echo "**".$resolution."**";

Venlig hilsen ha' en bra dag,
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]




[PHP] Output (Urgent!)

2001-07-17 Thread Fredrik A. Takle

Why doesn't this work? Any ideas?!

  $resolution = "document.write(screen.width)";

  if ($resolution >= '1024') {
$resolution = "1024";
  } else {
$resolution = "800";
  }
echo $resolution;

It always output 1024

Best regards
Fredrik A. Takle
Bergen, Norway



-- 
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]