Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #9616

Re: why php echo does not show up in HTML?

From Denis McMahon <denismfmcmahon@gmail.com>
Newsgroups comp.lang.php
Subject Re: why php echo does not show up in HTML?
Date 2013-05-24 22:25 +0000
Organization A noiseless patient Spider
Message-ID <knopdn$qpi$4@dont-email.me> (permalink)
References <78f2c263-051b-4b12-b2fc-049aeae3fdd6@z8g2000yqd.googlegroups.com> <43ef7f99-4f41-40b6-9e6a-0df557fcc30a@a8g2000yqp.googlegroups.com> <d96a352c-379c-4f87-be92-5884e7171eb0@d6g2000yqi.googlegroups.com>

Show all headers | View raw


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@gmail.com

Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

why php echo does not show up in HTML? steve nospam <steve.nospamm@gmail.com> - 2013-05-24 01:08 -0700
  Re: why php echo does not show up in HTML? "Andy" <andy@NOSPAMmanyplay.com> - 2013-05-24 09:50 +0100
    Re: why php echo does not show up in HTML? Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-24 09:25 -0400
  Re: why php echo does not show up in HTML? steve nospam <steve.nospamm@gmail.com> - 2013-05-24 01:53 -0700
    Re: why php echo does not show up in HTML? steve nospam <steve.nospamm@gmail.com> - 2013-05-24 01:57 -0700
      Re: why php echo does not show up in HTML? Denis McMahon <denismfmcmahon@gmail.com> - 2013-05-24 22:25 +0000
  Re: why php echo does not show up in HTML? steve nospam <steve.nospamm@gmail.com> - 2013-05-24 02:06 -0700
    Re: why php echo does not show up in HTML? steve nospam <steve.nospamm@gmail.com> - 2013-05-24 06:20 -0700
      Re: why php echo does not show up in HTML? Tim Streater <timstreater@greenbee.net> - 2013-05-24 14:40 +0100
        Re: why php echo does not show up in HTML? Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-24 09:55 -0400
          Re: why php echo does not show up in HTML? Tim Streater <timstreater@greenbee.net> - 2013-05-24 16:47 +0100
            Re: why php echo does not show up in HTML? Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-24 12:07 -0400
              Re: why php echo does not show up in HTML? Tim Streater <timstreater@greenbee.net> - 2013-05-24 18:04 +0100
                Re: why php echo does not show up in HTML? Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-24 13:30 -0400
            Re: why php echo does not show up in HTML? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-05-24 22:32 +0200
        Re: why php echo does not show up in HTML? steve nospam <steve.nospamm@gmail.com> - 2013-05-24 07:19 -0700
          Re: why php echo does not show up in HTML? Doug Miller <doug_at_milmac_dot_com@example.com> - 2013-05-24 15:02 +0000
            Re: why php echo does not show up in HTML? Denis McMahon <denismfmcmahon@gmail.com> - 2013-05-24 22:37 +0000
      Re: why php echo does not show up in HTML? The Natural Philosopher <tnp@invalid.invalid> - 2013-05-24 15:00 +0100
        Re: why php echo does not show up in HTML? steve nospam <steve.nospamm@gmail.com> - 2013-05-24 07:20 -0700
          Re: why php echo does not show up in HTML? Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-24 10:35 -0400
          Re: why php echo does not show up in HTML? The Natural Philosopher <tnp@invalid.invalid> - 2013-05-24 16:59 +0100
        Re: why php echo does not show up in HTML? Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-24 10:34 -0400
      Re: why php echo does not show up in HTML? "Peter H. Coffin" <hellsop@ninehells.com> - 2013-05-24 10:51 -0500
      Re: why php echo does not show up in HTML? Richard Yates <richard@yatesguitar.com> - 2013-05-26 07:02 -0700
    Re: why php echo does not show up in HTML? "J.O. Aho" <user@example.net> - 2013-05-24 20:26 +0200
      Re: why php echo does not show up in HTML? Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-24 15:34 -0400
  Re: why php echo does not show up in HTML? Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-24 09:35 -0400
    Re: why php echo does not show up in HTML? steve nospam <steve.nospamm@gmail.com> - 2013-05-24 07:14 -0700
      Re: why php echo does not show up in HTML? Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-24 10:38 -0400
        Re: why php echo does not show up in HTML? steve nospam <steve.nospamm@gmail.com> - 2013-05-24 07:53 -0700
          Re: why php echo does not show up in HTML? Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-24 11:06 -0400
          Re: why php echo does not show up in HTML? Doug Miller <doug_at_milmac_dot_com@example.com> - 2013-05-24 15:18 +0000
            Re: why php echo does not show up in HTML? Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-24 12:04 -0400
            Re: why php echo does not show up in HTML? gordonb.aykca@burditt.org (Gordon Burditt) - 2013-05-24 22:59 -0500
              Re: why php echo does not show up in HTML? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-05-25 09:20 +0200
              Re: why php echo does not show up in HTML? Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-25 09:22 -0400
          Re: why php echo does not show up in HTML? Denis McMahon <denismfmcmahon@gmail.com> - 2013-05-24 22:49 +0000
            Re: why php echo does not show up in HTML? Scott Johnson <noonehome@chalupasworld.com> - 2013-05-24 17:06 -0700
      Re: why php echo does not show up in HTML? Doug Miller <doug_at_milmac_dot_com@example.com> - 2013-05-24 15:12 +0000
      Re: why php echo does not show up in HTML? Richard Yates <richard@yatesguitar.com> - 2013-05-26 07:13 -0700
  Re: why php echo does not show up in HTML? yousafali3949@gmail.com - 2017-07-16 07:14 -0700
    Re: why php echo does not show up in HTML? Mark Lloyd <not@mail.invalid> - 2017-07-16 09:55 -0500
  Re: why php echo does not show up in HTML? V <vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvva@hotmail.com> - 2023-07-11 22:22 -0700

csiph-web