hey, is it possible to use php variables in javascript? i been trying to create an admin notes section on my users profiles that only admin can see, and to make notes on each user.
it works great, but i am unable to parse a php variable within the javascript, here is the code im using:
PHP Code:
// notes
if (allow_access(3)) {
$res = sql_query("SELECT * FROM `".tb()."accounts` where id={$owner['id']}");
$output = '';
while ($row = sql_fetch_array($res)) {
$f = 1;
$output = '<script language="javascript" type="text/javascript" src="js/jeditable.js"></script>
<script>
$(document).ready(function() {
$(\'.edit_area\').editable("index.php?p=u/'.$row['username'].'/savenote", {
type : \'textarea\',
cancel : \'Cancel\',
submit : \'OK\',
});
});
</script>
<div class="edit_area" id="div_2">'.$row['notes'].'</div>';
}
ass(array('title'=>t('User Notes'), 'content' => $output));
}
what it does, it displays plain text on the users profile, displaying notes on the user, and onclick of the plain text, it turns into a textarea with the notes pre-loaded, and once finished making notes, click submit and the form is submitted to another function for processing, but as u can see, i need to use a variable within the url to send for processing.
can anyone advise?
thanx
Bookmarks