Page 1 of 1

php and javascript

Posted: Fri Jan 05, 2007 11:01 am
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

Posted: Fri Jan 05, 2007 11:03 am
by feyd
Have you tried it?


It generally works.

Posted: Fri Jan 05, 2007 7:37 pm
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.