php and javascript

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
sarris
Forum Contributor
Posts: 137
Joined: Mon Dec 04, 2006 2:44 pm

php and javascript

Post by sarris »

Hi there. I have a php script file which collects data from a database. As the data is collected i form a variable $display_block which contains HTML code.In the end of the php file i have an <html> tag to show the results.

Code: Select all

<HTML>
<HEAD>
<TITLE> Search Results</TITLE>
</HEAD>
<BODY>
<?php echo $display_block; ?>
</BODY>
</HTML>
If in that html code variable i include javascript calls will it work? where should i have the scripts? in the php file?

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

Post by feyd »

Have you tried it?


It generally works.
User avatar
Ollie Saunders
DevNet Master
Posts: 3179
Joined: Tue May 24, 2005 6:01 pm
Location: UK

Post by Ollie Saunders »

PHP is invisible to the browser. It doesn't care if its coming from a variable or not.
If you view the source of your output you can see what PHP is generating and the browser is interpreting.
Post Reply