View Full Version : Echo help ;l

06-30-2010, 12:26 PM
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


06-30-2010, 01:23 PM
I'm thinking this way ... but it might be the 16th time you failed ... lol ...

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

06-30-2010, 01:29 PM
Yea is the 16th but i think i know how now thanks

07-06-2010, 03:03 AM
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:

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