It seems like it might be an error related to arrays, but I can't figure it out. I really start with PHP and it gets a little intimidating. Any help would be greatly appreciated! here is my code:
<?php echo "<h1>Choose a Poll!</h1>"; $read = file('poll_topics.txt'); $data = array( ); foreach($read as $lines){ list($key,$v) = explode("|","$lines"); $data[$key] = $v; } foreach ($data as $k=>$desc){ echo "<ul><li><a href='take_a_poll.php?poll=$k'>$k</a> - $desc </li></ul>"; } ?>
Here is what is in the text file:
Instruments|What kind of instruments do you like? Music|What type of music do you like best?
I have to clarify: The error is line 20 or where list($key,$v) = explode...
source share