RE: [PHP] Storing Java Script Varable into php variable

From: Date: Fri, 20 Jul 2001 15:43:20 +0000
Subject: RE: [PHP] Storing Java Script Varable into php variable
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-58928@lists.php.net to get a copy of this message
Hi Mike! Generally the only way to send information from a clientside javascript to a serverside language (in this case PHP) is via a form submit or putting that value into an HREF the user will click. For example: <!-- your javascript functions function show(){ if (!document.all&&!document.layers) document.option1.t1=screen.width; document.option1.t2=screen.height; document.option1.t3=screen.colorDepth; document.option1.t4=screen.pixelWidth; return document.t.t1.value=screen.width document.t.t2.value=screen.height document.t.t3.value=screen.colorDepth document.t.t4.value=screen.pixelDepth } show() function submitForm() { form = document.option1; form.submit(); } // --> <!-- option #1 // --> <form action="foo.php" name="option1" method="Post"> <input type="hidden" value="" name="t1"> <input type="hidden" value="" name="t2"> <input type="hidden" value="" name="t3"> <input type="hidden" value="" name="t4"> </form> <!-- your link // --> <a href="javascript:submitForm()">Save your screen settings...</a> (please note: this is all rough code off the top of my lacking caffeine head...it has not been debugged or anything else. or in other words, it's an approximation. ;] ) Hope this helps, - Erik

« previous php.general (#58928) next »