Advanced Search

Results 1 to 3 of 3

Thread: I need to echo $qs within an echo, but what I have isn't working....

  1. #1
    Join Date
    Oct 2012
    Posts
    129
    Thanks
    15
    Thanked 1 Time in 1 Post

    Default I need to echo $qs within an echo, but what I have isn't working....

    Hi guys!

    I need to show a $qs within an echo, but I have no clue how. Right now I have this and it's not showing:

    echo '<a href="/?<?php echo $qs; ?>do=reportabuse&confirm=1">confirm</a>';

    How do I make <?php echo $qs; ?> to actually show in this instance?


    Thanks!

  2. #2
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    1,884
    Thanks
    16
    Thanked 288 Times in 287 Posts
    Blog Entries
    4

    Default

    You're trying to echo inside of an echo - either break out of php by closing the tag first, and then echo within the HTML;
    Code:
    // end php
    ?>
    <a href="/?<?php echo $qs; ?>do=reportabuse&confirm=1">confirm</a>
    <?php // start php again
    Or remove the second echo and break in and out of the string with '.$variable.';
    Code:
    echo '<a href="/?'.$qs.'do=reportabuse&confirm=1">confirm</a>';
    Also, don't forget the semi-colon on the end of your echo.
    Focus on Function Web Design | Latest News RSS | Facebook | Twitter |
    Fast Edit (A flat file, PHP web page editor & CMS. Small, FREE, no database!) | Fast Edit BE (Snippet Manager) (Web content editor for multiple editable regions!) | Fast Apps |
    The only limit to creativity is imagination: JemCon.org

  3. The Following User Says Thank You to Beverleyh For This Useful Post:

    qwikad.com (03-17-2013)

  4. #3
    Join Date
    Oct 2012
    Posts
    129
    Thanks
    15
    Thanked 1 Time in 1 Post

    Default

    It's working. You rock!
    Last edited by qwikad.com; 03-17-2013 at 11:13 PM.

Similar Threads

  1. Resolved echo not working
    By Kage Kazumi in forum PHP
    Replies: 7
    Last Post: 10-21-2012, 08:07 PM
  2. echo nothing?
    By begeiste in forum PHP
    Replies: 3
    Last Post: 11-22-2011, 07:02 PM
  3. echo css
    By ggalan in forum PHP
    Replies: 7
    Last Post: 06-29-2010, 01:13 AM
  4. echo inside an echo?
    By crobinson42 in forum PHP
    Replies: 5
    Last Post: 05-20-2010, 02:32 AM
  5. echo...
    By pavmoxo in forum PHP
    Replies: 11
    Last Post: 04-28-2006, 04:55 PM

Bookmarks

Posting Permissions

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