home | list info | list archive | date index | thread index

[OCLUG-Tech] html/php 'Hello World'

Hi;

I got the 'Hello World' practice file working then began playing with
it. My problem is getting the commenting out to work.  I have obviously
missed something.

Here is the little program:
<html>
  <head>
    <title>'PHP Test'</title>
  </head>

  <body>

  <?php echo '<p>Hello World</p>' ?>

<!--
  <?php
  if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE) {
    <h3>'strpos()must have returned non-false'</h3>
    <p>'You are using Internet Explorer'</p>

  <?php
   } else {
  ?>

    <h3>'strpos() must have returned false'</h3>
  <p>'You are not using Internet Explorer.'</p>

  <?php
   }
  ?>
-->

  </body>

</html>


  <?php /*phpinfo();*/ ?>  

The HTML manual told me to use <!-- and --> to make comments.  The body
outside of the comment tags worked on my browser as it should.  The
stuff in between <!-- ... --> is things that I am trying out (playing
with). I wanted to comment out the stuff in order to find the error
causing the blank screen that I am getting on my browser.  My main
concern and to which I don't seem to be able to find an answer is how to
comment out properly.

Similarly, <?php /*phpinfo();*/ ?> at the bottom is something I used to
experiment with commenting out in PHP.  Originally I had  /*
<?php /*phpinfo(); ?> */ placed where it is now -- outside of HTML or
any other tags yet the string showed up on my browser screen. That
doesn't make sense to me.  So, why?


-- 
Regards Bill


message navigation