$_POST in echo as text

Discussion in 'PHP' started by zodiac, Aug 13, 2008.

  1. #1
    say you have a bunch of html and php in an echo (such as a submit form) and a description you want is "enter $_POST here".

    is there a way that you can have $_POST show up as text instead of acting as a php function?
     
    zodiac, Aug 13, 2008 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    
    <?php echo "enter {$_POST['foo']} here."; ?>
    
    PHP:
     
    nico_swd, Aug 14, 2008 IP
  3. Barti1987

    Barti1987 Well-Known Member

    Messages:
    2,703
    Likes Received:
    115
    Best Answers:
    0
    Trophy Points:
    185
    #3
    Use ' instead of "

    
    echo 'Enter $_POST here';
    
    PHP:
    Peace,
     
    Barti1987, Aug 14, 2008 IP
  4. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #4
    I guess I misunderstood his question then.

    While I would use single quotes too, note that you can also escape the dollar sign:
    
    echo "Enter \$_POST here";
    
    PHP:
     
    nico_swd, Aug 14, 2008 IP
  5. Ilyes

    Ilyes Banned

    Messages:
    129
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #5
    <?php echo $_POST['...'] ; ?>
     
    Ilyes, Aug 14, 2008 IP