Re: is it possible to communicate javascript and php?

From: Date: Sun, 21 Jan 2001 01:27:38 +0000
Subject: Re: is it possible to communicate javascript and php?
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-35863@lists.php.net to get a copy of this message
On Sat, Jan 20, 2001 at 05:20:53PM -0800, Alex Black wrote : > no without submitting information to the server with get or post. > > for example, if a bit of javascript you have comes up with some value, the > only way you can get it to the server is to put it in a get and send the > user to that url: > > http://www.mysite.com/index.php?your_js_var=your_value With 'post' methods its also possible this way (works NS and IE): <script language="JavaScript"><!-- function do_something( form) { form.jsvar.value = form.bla.selcetedIndex; form.submit(); return true; } //--></script> <form name="mainform", action="<?echo$PHP_SELF?>" methos="post"> <input type="hidden" name="jsvar" value=""> <selcet name="bla"> <option> foo <option> bar </select> <input type="button" onclick="do_something( document.mainform)" value="click"> </form> You know have set the phpvar $jsvar from within javascript. m. -- Markus Fischer, http://josefine.ben.tuwien.ac.at/~mfischer/ EMail: mfischer@josefine.ben.tuwien.ac.at PGP Public Key: http://josefine.ben.tuwien.ac.at/~mfischer/C2272BD0.asc PGP Fingerprint: D3B0 DD4F E12B F911 3CE1 C2B5 D674 B445 C227 2BD0

« previous php.general (#35863) next »