PDA

View Full Version : PAss Variable in PHP to JavaScript


vikaspa
10-27-2002, 06:13 AM
I have program written in PHP

and I am using Javascript for some animation effect (some text is scrolling)

I donot want to standard text to scroll but I want to fetch some information from database, form a string and wiash the conents of this string to scroll.

I can form the required string.
I want to knw how do I pass on this string to Javascript.

In most of the examples a string is given in QUOTES.

Please help !!

mordred
10-27-2002, 10:17 AM
Ehm, PHP operates on the server, and JavaScript on the client. And since JavaScript is also delivered as text within <script> tags, all you have to do is to echo your PHP string at the right place.


var str = "<?php echo $myPhpString; ?>";


You lost me though with your comment that all strings you've seen are in double quotes... how does that relate to your problem?

vikaspa
10-27-2002, 05:46 PM
Lots of thanks for response in time.

With regards
Vikas Athavale