Jump to content

[SOLVED] Embedding PHP code in HTML form


billbrach

Recommended Posts

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 here
Back 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
Link to comment
Share on other sites

[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 code
print some text here
Back into normal HTML

This is what is actually displayed:

This is normal HTML code
Back 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!)
Link to comment
Share on other sites

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.
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.