billbrach Posted December 20, 2006 Share Posted December 20, 2006 I have seen examples of this in web tutorials but I cannot make it work. Maybe it is a PHP server setting problem ??I have a file called 'test.htm', contents in code window here:[code]<html><head><title>PHP Test Page</title></head><body>This is normal HTML code<?php print ("print some text here");?><br>Back into normal HTML</body></html>[/code]This is what I would expect to see in my browser window:[color=red]This is normal HTML code print some text hereBack into normal HTML [/color]This is what is actually displayed:[color=red]This is normal HTML code Back into normal HTML [/color]Any ideas why the text '[color=red]print some text here[/color]' in the PHP print statement, is NOT displayed by the browser ??Bill Quote Link to comment Share on other sites More sharing options...
DeathStar Posted December 20, 2006 Share Posted December 20, 2006 [quote]I have seen examples of this in web tutorials but I cannot make it work. Maybe it is a PHP server setting problem ??I have a file called 'test.htm', contents in code window here:Code:<html><head><title>PHP Test Page</title></head><body>This is normal HTML code<?php print ("print some text here");?><br>Back into normal HTML</body></html>This is what I would expect to see in my browser window:This is normal HTML codeprint some text hereBack into normal HTMLThis is what is actually displayed:This is normal HTML codeBack into normal HTML [/quote]Hmm,, Try the php part like this[code]print "print some text here";[/code]or els try echo (The same but worth the try!) Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted December 20, 2006 Share Posted December 20, 2006 Save test.htm to test.php instead.PHP code is only executed if the file has a .php extension on it and the server is configuredo parse PHP files with the PHP interpreter too.Web browsers do not understand PHP code. Quote Link to comment Share on other sites More sharing options...
billbrach Posted December 20, 2006 Author Share Posted December 20, 2006 Hey, thanks !!I don't have the liberty of changing it to a PHP extension file, 'cause its part of an existing program I adding features to.Shouldn't the server output the text as HTML, which the browser would then understand ? If the server just output the text it would be fine too.Also, my example is very simplified just to show the problem, I'm actually needing to output PHP vars. That part I have working. Quote Link to comment Share on other sites More sharing options...
Daniel0 Posted December 20, 2006 Share Posted December 20, 2006 Then you'll need to add this to your .htaccess/httpd.conf file: [code]AddType application/x-httpd-php .htmAddType application/x-httpd-php .html[/code] Quote Link to comment Share on other sites More sharing options...
billbrach Posted December 21, 2006 Author Share Posted December 21, 2006 SOLVED !! You guys are good !! Daniel0 nailed it, I just KNEW it was something simple.... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.