I have an assignment that requires me to create two mock music services, each with a small library of songs available for purchase. If I can figure out how to make one work, the rest should be simple for the most part. I managed to get checkboxes working ONCE in my file but I modified one thing VERY SLIGHTLY and now the whole thing refuses to work. What I need to know is how to generate several checkboxes using a text file (which I put into an array), save the selected choices, and put that into a new text file to be read by another .php thing. This is what I have so far.
<html>
<?php
//Get contents from zmzonSongs.txt file, put into array.
$songList = explode("\n", file_get_contents('zmzonSongs.txt'));
//Print songs to be selected.
foreach($songList as $songs){
echo "<br/><input type='checkbox' name=\'$songList[]\' value='$songs />$songs<br>";
}
?>
</html>
I need help immediately. The assignment is due soon and I'm struggling to make this work. I need to make it so that the contents of the array can be written into some file after whichever songs the user wants are selected.