Hey,
i am a beginner to php and cannot seem to find out why my counter keeps resetting to 0
Below is my code:
please note this code works, the first window.alert gives me 0, the loop runs twice, but everytime it comes back to window.alert it gives me 0...
i have tried to put the window.alert after the $count++; in the php tags and it gives me 1, meaning the counter does add 1..but again when it loops the second time, the $count shows as 0 ??
so frustratingany ideas???
Code Below:
Code:<script language="JavaScript" type="text/javascript"> function LoadSchedule() { <?php session_start(); $visitorE = Array(); $visitorE = $_SESSION['visitorSchedule']; $count = 0; ?> var eventCount = '<?php echo count($visitorE);?>'; var scheduleDiv = document.getElementById("schedule-layout"); for(var intCount=0;intCount<eventCount;intCount++) { window.alert('<?php echo $count;?>'); <?php $schedule = Array(); $schedule = $visitorE[$count]; ?> scheduleDiv.innerText += "<?php echo 'Event: ' . $schedule[0]; echo ' | Date: ' . $schedule[1]; echo ' | Time: ' . $schedule[2]; echo ' | Venue: ' . $schedule[3]; echo ' | Location: ' . $schedule[4];?>"; <?php $count++;?> } } </script>


any ideas???
Reply With Quote


Bookmarks