58
rated 0 times
[
65]
[
7]
/ answers: 1 / hits: 20124
/ 14 Years ago, fri, october 29, 2010, 12:00:00
i want to pass my php variable in one javascript function.
i know it seems simple but i don't know where am i missing something?
<?php
while($gg=mysql_fetch_array($lg))
{
?>
<td id=add_td>
<?php
$id = $gg['p_id'];
echo <a onclick=cnf('Are you sure you want to delete that?',$id)>; ?>Delete</a>
</td>
<?php
}
?>
and in my javascript function
function cnf(msg,id)
{
cnf = confirm(msg);
if(cnf) {
parent.location.href = 'p_update.php?d=' + id;
}
}
so i need to know on which id that user had clicked so that i will only delete that id from database.
if i try this thing then it showing error on cnf function and its saying like unterminated string literal?
More From » php