echo ! question
Results 1 to 4 of 4

Thread: echo ! question

  1. #1
    Junior Member
    Join Date
    Mar 2013
    Posts
    1

    echo ! question

    I'm trying to achieve the output where the remote ip is 1.2.3.4(for example):
    1.2.3.4 !--IPADDR=1.2.3.4-->

    I've tried just about everything...here is one variation:
    <?php
    echo "<";
    echo "!";
    echo "--IPADDR=";
    echo $_SERVER['REMOTE_ADDR'];
    echo
    "-->";
    ?>

    No matter what I try the ! screws it up.
    If I do:
    <?php
    echo "!"';
    ?>

    It seems to work, but as soon as I try
    <?php
    echo "<";
    echo "!"';
    ?>


    Nothing displays...any help is appreciated.

    Thaks.

  2. #2
    Senior Member Derokorian's Avatar
    Join Date
    Apr 2011
    Location
    Denver
    Posts
    1,767
    <!-- [stuff] -->

    This is the syntax for an HTML comment. Perhaps you simply need to right click on the page and select View Source to see the comment.
    Sadly, nobody codes for anyone on this forum. People taste your dishes and tell you what is missing, but they don't cook for you. ~anoopmail
    I'd rather be a comma, then a full stop.
    User Authentication in PHP with MySQLi - Don't forget to mark threads resolved - MySQL(i) warning

  3. #3
    Pna lbh ernq guvf¿
    Join Date
    Jul 2004
    Location
    Kansas City area
    Posts
    19,399
    Also note there's no need to use separate echo statements...

    PHP Code:
    echo "<!--IPADDR=$_SERVER[REMOTE_ADDR]-->";

    // or...

    echo "<!--IPADDR=" $_SERVER['REMOTE_ADDR'] . "-->";

    // or...

    printf"<!--IPADDR=%s-->"$_SERVER['REMOTE_ADDR'] ); 

  4. #4
    Un Re Member cretaceous's Avatar
    Join Date
    Sep 2004
    Location
    London UK
    Posts
    938
    Quote Originally Posted by Michael297 View Post
    <?php
    echo "<";
    echo "!"';
    ?>
    may not be the problem everywhere but this one has an extra single quote:
    echo "!"';

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •