Possible Duplicate:
Reference: Why does the PHP code in my Javascript not work?
This is my attempt to go through an array of pictures.
$rows2 is an array of pictures. I can manually
echo '<img src="' . $rows2[0] . '"/>';
or
echo '<img src="' . $rows2[1] . '"/>';
or
echo '<img src="' . $rows2[2] . '"/>';
and that works fine. So, I added a javascript button and an alert button for testing.
I can see that the var is change from 0 to 1 to 2 however, no picture appears at any point.
<div class="half" id="right">
<?
echo '<img src="' . $rows2["<script>document.write(counter)</script>"] . '"/>';
?>
<button onclick="counter++">Increment</button>
<button onclick="counter--">Decrement</button>
<button onclick="alert(counter)">alert</button>
</div>
what am I doing wrong?