asanti Posted September 13, 2014 Share Posted September 13, 2014 I have this 3 tables users (id_user) music_styles (id_style, style) ex. (1) - (Blues) user_styles (id_user, id_style) I'm trying to create a form in which the user ($user = $_SESSION['id_user']) chooses through a multiple select the styles of preference to store them in the database using mysqli statements. If the styles prefered are selected they should be displayed in the select input later, how can i accomplish this? Thanks. Quote Link to comment Share on other sites More sharing options...
Solution Barand Posted September 13, 2014 Solution Share Posted September 13, 2014 When you create the selection dropdown for music styles, use SELECT ms.idstyle , style , id_user FROM music_styles ms LEFT JOIN user_styles us ON ms.id_style = us.id_style AND us.id_user = $user Those styles with a user id should be marked as "selected" Quote Link to comment Share on other sites More sharing options...
asanti Posted September 13, 2014 Author Share Posted September 13, 2014 When you create the selection dropdown for music styles, use SELECT ms.idstyle , style , id_user FROM music_styles ms LEFT JOIN user_styles us ON ms.id_style = us.id_style AND us.id_user = $user Those styles with a user id should be marked as "selected" Thanks Barand, what about the db process? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.