Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4

Thread: Echo help ;l

  1. #1
    Regular Coder
    Join Date
    Jun 2010
    Location
    Sutton-in-ashfield, Notts
    Posts
    117
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Echo help ;l

    Right i want to make a echo with ajaxpage command like so..


    <?php echo 'Username: <b><a href="#" onClick="ajaxpage(''.$path.'/profile/'.$row[username"].', 'think'')">'.$row["username"].'</a></b><br />'; ?>

    Can anyone help me ive change it like 15 times ;l

    Thanks

  • #2
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,464
    Thanks
    8
    Thanked 1,085 Times in 1,076 Posts
    I'm thinking this way ... but it might be the 16th time you failed ... lol ...

    PHP Code:
    <?php echo"Username: <b><a href=\"#\" onClick=\"ajaxpage('$path/profile/{$row[username]}', 'think')\">{$row[username]}</a></b><br />";?>

  • #3
    Regular Coder
    Join Date
    Jun 2010
    Location
    Sutton-in-ashfield, Notts
    Posts
    117
    Thanks
    7
    Thanked 0 Times in 0 Posts
    Yea is the 16th but i think i know how now thanks

  • #4
    New Coder
    Join Date
    May 2009
    Location
    Pennsylvania, United States
    Posts
    54
    Thanks
    16
    Thanked 0 Times in 0 Posts
    The echo()ed stuff is single quoted; while the content inside is wrapped in double quotes, the single quotes don't treat $'s like a variable.

    Try this:

    Code:
    echo 'Username: <b><a href="#" onClick="ajaxpage('''.$path.'/profile/'.$row['username']"]', 'think'')">'.$row["username"].'</a></b><br />';
    [EDIT]CodingForums messed the quotes up...but you catch my drift.

    Oh, and don't forget to quote array keys. You'll have errors, you know! :P
    //EDIT
    Last edited by johnnnn; 07-06-2010 at 02:05 AM. Reason: Caught my attention...


  •  

    Posting Permissions

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