View Full Version : Echo help ;l

06-30-2010, 11:26 AM
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, 12: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, 12:29 PM
Yea is the 16th but i think i know how now thanks

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