So I have an array $papers, that comes from a database. The size of the array can change at the will of whoever changes the database.
I thought that if I did something like:
foreach($papers as $paper) {
echo '<option value="' . $paper . '">' . $paper . '</option>';
}
I could get a dynamic list in my form. However, for some reason when I try this, the webpage just comes up blank. Obviouslly I could do something like:
for($i = 0; $i < SOME_NUMBER; $i++) {
echo '<option value="' . $papers[$i] . '">' . $papers[$i] . '</option>';
}
But with the size of the array being variable, it doesn't seem like a viable option. Also, when I use the second method of a simple for loop, the page loads, and the values do actually come up. I'm very confused as to why that is though. Any help would be awesome, thanks.
print_r($papers)and see what you get.php -l filename.phpto check it for parse errors.ini_set("display_errors", 1);Remember to disable it again after you are done degugging