FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » why php echo does not show up in HTML?
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: why php echo does not show up in HTML? [message #181668 is a reply to message #181616] Fri, 24 May 2013 22:25 Go to previous messageGo to previous message
Denis McMahon is currently offline  Denis McMahon
Messages: 634
Registered: September 2010
Karma:
Senior Member
On Fri, 24 May 2013 01:57:54 -0700, steve nospam wrote:

>> I have found out by trial and error is that when I change the file
>> extension to .php instead of .htm, then it works.
>>
>> However, I read that php can be used inside .htm? I do not want to
>> change all my .htm file extensions to .php as that will break many
>> links I have.

This is a matter for the webserver configuration. If you want the
webserver to parse your .htm files with the php preprocessor, then you
have to tell the webserver to do so. Normally the webserver by default
will only send .php files to the php preprocessor.

> Another thing I found by trial and error. If I keep the file as .htm,
> but change the code to the following, where a <P> was added to inside
> the string. That is the only change made.

> <?php echo '<p>do you see this?'; ?>

> Then I get the echo ! But it looks not correct:
>
> before do you see this?'; ?>
>
> So I have no idea what is going on.

Right. What happens here is that the web browser sees:

"<?php echo '<p>"

As an element tag, startiong at "<" and ending at ">" but it does not
recognise it, so it ignores it. Then it sees:

"do you see this?'; ?>"

as document body text, and it displays it in the document body.

By adding the "<p>" you inserted a ">" character after the "<" of "<?php"
and that ">" became the closing marker of the tag.

I've tried to explain this as clearly as I can, please re-read it until
you are sure you understand it.

--
Denis McMahon, denismfmcmahon(at)gmail(dot)com
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: PHP Contact Form, mt-rand(), problem Validating 1 input
Next Topic: Parsing mbox files with Windows Php
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Wed Nov 27 16:00:55 GMT 2024

Total time taken to generate the page: 0.05974 seconds