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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.