This is what I do in one of my programs.  I set hidden values in my HTML and
then JS can access them, change them, and then when the form is submitted
(JS can do that too if you want it to be automatic) the PHP reads in the
hidden values.


-----Original Message-----
From: 1LT John W. Holmes [mailto:[EMAIL PROTECTED]] 
Sent: Monday, April 29, 2002 11:40 AM
To: [EMAIL PROTECTED]; Steve Buehler
Subject: Re: [PHP] javascript and PHP

All you can do is use PHP to print out Javascript code.

$data = "hello world";
<script language="javascript">
var something;
something = '<?=$data?>';

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" <[EMAIL PROTECTED]>
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

PHP General Mailing List (
To unsubscribe, visit:

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to