Passing Javascript variables to PHP
Posted: Thu Feb 13, 2003 10:07 pm
Maybe I'm staring at this too long. I'm trying to pass the screen width, obtained from Javascript screen.width, into a PHP variable. The results don't make any sense: (1) $REZ echos correctly but (2) $wyde never gets changed based on the value of $REZ. I'm running this from an 800x600 screen. For other sizes, change 800 to 1024 etc.
Somebody clue me in on what's going on here.
Bob from Las Vegas
<HTML><HEAD>
<?php $REZ = "<script language=javascript>
document.write(screen.width); </script>" ; ?>
</HEAD><BODY>
<?php
$wyde = "UNCHANGED!" ;
if( $REZ == 800 ) $wyde = "changed to Numeric 800";
if( $REZ == "800" ) $wyde = "changed to Alpha 800";
echo "REZ=" . $REZ . "! and variable is " . $wyde;;
?>
</BODY></HTML>
Somebody clue me in on what's going on here.
Bob from Las Vegas
<HTML><HEAD>
<?php $REZ = "<script language=javascript>
document.write(screen.width); </script>" ; ?>
</HEAD><BODY>
<?php
$wyde = "UNCHANGED!" ;
if( $REZ == 800 ) $wyde = "changed to Numeric 800";
if( $REZ == "800" ) $wyde = "changed to Alpha 800";
echo "REZ=" . $REZ . "! and variable is " . $wyde;;
?>
</BODY></HTML>