Passing a variable from php to javascript
Posted: Tue Dec 16, 2008 4:00 pm
Hi all
I think I'm missing the point here. Why can't I pass the $hello string to a javascript alert function? If i replace the $hello with 'hello world' it's all good. I've only today started tinkering with javascript so go easy on me. If you know of a good tutorial (video would be nice) please let me know.
Thanks, Steve
I think I'm missing the point here. Why can't I pass the $hello string to a javascript alert function? If i replace the $hello with 'hello world' it's all good. I've only today started tinkering with javascript so go easy on me. If you know of a good tutorial (video would be nice) please let me know.
Thanks, Steve
Code: Select all
<?php
$seller_count = 5;
$basket_items = 10;
for ($row=0; $row <=$basket_items; $row++)
{
echo "<TR>";
for ($column=0; $column <= $seller_count; $column ++)
{
$to_display = $row."--".$column.":";
$hello ='hello world';
?> <TD> <?php echo $to_display ?> <input type=radio name="a" onclick= "alert($hello);"></TD> <?php
}
echo "</TR>";
}
?>