passing a php variable into javascript function
I am trying to pass a php value, obtained from a join query, to a
javascript function. The javascript function will open a new window and
show some data based on the passed value.My query works fine but the php
value is not passed to the JS function.
My code :
<script type="text/javascript">
function product(var) {
window.open( "view_product_info.php?var", "myWindow",
"status = 1, height = 300, width = 300, resizable = 0" )
}
</script>
\\ the line where i am trying to pass the php varibale
echo '<td align="center" ><a href="javascript:product('.$product_id.');">
<br/> '.$row['product_name'].'</a></td>';
why the php value $product_id is not passed to the product function.
Thanks in advance.
No comments:
Post a Comment