how to include php in JavaScript ?

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
HormonX
Forum Commoner
Posts: 50
Joined: Tue Dec 10, 2002 7:43 pm
Location: Toronto

how to include php in JavaScript ?

Post by HormonX »

I was wondering and that has to do with my prewious question about dynamicaly updating combo boxes i have found the script that does just that but it's all in JavaScript. Now to and it dynamicaly willin all the information i need i have to use PHP ... question is how. Can anyone help me with this ? i have tried to insert php tag within JavaScript but that did not work well. How would i do that.?

Thanx

Greg
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

use [php_man]echo[/php_man] or [php_man]print[/php_man]
User avatar
Joe
Forum Regular
Posts: 939
Joined: Sun Feb 29, 2004 1:26 pm
Location: UK - Glasgow

Post by Joe »

Thing of the workings of html/php. Then think js/php. They work much the same way. As feyd said: use echo or print
User avatar
Wayne
Forum Contributor
Posts: 339
Joined: Wed Jun 05, 2002 10:59 am

Post by Wayne »

I think HormonX is getting confused between Server side PHP and client side Javascript, you cant use php to update the page once it has been loaded PHP is server side, you will need to write arrays into the Javascript section using php when you create the page and then once the page has loaded you will need to use Javascript to rewrite the combo boxes using the the arrays
Post Reply