Re: how to access javascipt variables in PHP

From: Date: Thu, 18 Jul 2002 11:27:54 +0000
Subject: Re: how to access javascipt variables in PHP
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-108244@lists.php.net to get a copy of this message
Wouldnt this work? <form name=myForm action=sendPage.php action=post> <script language = javascript> function myFunc(){ var myJavaScriptVar = initialValue... ....Do What Ever (manipulate myVar)... document.myForm.fieldName.value = myJavaScriptVar; </script> <input type=hidden name=fieldName value=init> <?php // If the function my Func has been executed you can do // the following... echo "<input type=hidden name=fieldName value=$fieldName>"; ?> // If you are not running apache (if running IIS) you may get an undefined // variable notice on running your script to rid yourself of // this do the following instead of the php above... <?php if(isset($fieldName)){ echo "<input type=hidden name=fieldName value=$fieldName>"; } ?> Hope this Helps... Spike...

« previous php.general (#108244) next »