Re: javascript and PHP

From: Date: Mon, 29 Apr 2002 15:40:10 +0000
Subject: Re: javascript and PHP
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-95180@lists.php.net to get a copy of this message
All you can do is use PHP to print out Javascript code. <? $data = "hello world"; ?> <script language="javascript"> var something; something = '<?=$data?>'; </script> etc...It's no different than using PHP to print out HTML code. Now, if you want to get that Javascript variable "something" sent back to PHP, you have to assign it to a form element or tack it onto a URL. ---John Holmes... ----- Original Message ----- From: "Steve Buehler" <steve@vespro.com> To: <php-general@lists.php.net> Sent: Monday, April 29, 2002 11:29 AM Subject: [PHP] javascript and PHP > Does anybody know of a good/short tutorial about passing variables from > JavaScript to/from PHP? For example, how to do the following: > > <html> > <head> > <SCRIPT LANGUAGE="JavaScript"> > data = "hello world"; > </script> > </head> > <body> > <? > echo "$data<br>"; > ?> > </body> > </html> > > The above might at least give me a clue. Just a note. I really know > nothing to speak of about JavaScript. > > Thanks in Advance > Steve >

« previous php.general (#95180) next »