Results 1 to 6 of 6
Thread: Making an array output to input?
Mar 31, 2013, 21:30 #1
- Join Date
- Nov 2004
- 2 Post(s)
- 0 Thread(s)
Making an array output to input?
Now I found a code that I modified and it is doing what I want (almost). The code is generating the music genre from a table of songs (with a lot of info) called table_genre with the fields genre_id and genre_name.
These are included in a form as checkboxes. The user can check one or more boxes of the genres that suit the song.
Then I want to input this into my table called songs_genre, but right now I only have it on my screen separated with comma.
$song_genre = count($_POST['song_genre']) ? $_POST['song_genre'] : array();
//echo out the choices separated by a comma
echo count($song_genre) ? implode(', ',$song_genre) : 'Nothing!';
Can anyone tell me how to change the code above, so it is inserted as separated lines together with the song_id into my table called song_genre
If the song is $song_id=32. The genre is rock (song_genre 5), instrumental (song_genre 12).
Then I would like them inserted into my table (songs_genre) as :
song_id | song_genre
32 | 5
32 | 12