Here is the header of my page (I am mixing a bit of javascript with php, but it seems like the problem is with the php part):
Code: Select all
<script type="text/javascript">
function start() {
<?php
$slot = array(0,0,0,0,0,0);
?>
}
function drop() {
<?php
$i = 0;
for ($i = 0; $i < 6; $i ++) {
if ($slot[$i] == 0) {
$slot[$i] = 1;
?>
document.getElementById("s"+<?php echo $i ?>).innerHTML="This";
<?php
break;
}
}
?>
}
</script>
The problem is that once it runs through the drop() function, it works fine, but when the function ends it sets the $slot array back to 0,0,0,0,0,0. Is there any reason why this would be happenng? Any help would be helpful.. Thanks!