We Must Design Posted June 14, 2007 Share Posted June 14, 2007 I am creating a database of cocktails. The cocktails are entered into my database using a form. The user first enters the name of the cocktail and then enters the ingredients. I have created 3 combo boxes witch poulate from the database. The 2 combo boxes are: [amount] [measurement] [ingredient] Obviously a cocktail may contain many ingredients so I used a while loop to create more copies of the combo box like so: [amount] [measurement] [ingredient] [amount] [measurement] [ingredient] [amount] [measurement] [ingredient] [amount] [measurement] [ingredient] The only problem is that I have no idea how to only input the data from the combo boxes that have been selected. Any guidance would be much appreciated. Cheers, Chris Quote Link to comment https://forums.phpfreaks.com/topic/55583-help-with-a-form/ Share on other sites More sharing options...
Full-Demon Posted June 14, 2007 Share Posted June 14, 2007 In the first place I would use a ',' to seperate ingredients instead of creating new rows. You can seperate the values than with the explode() function. Second: you need to use MySQL, as you probably already do. Than you can select only a certain column. (ingredients for instance): SELECT ingredients FROM cocktails Where cocktails is the table. Not sure if this is what you want to know.... FD Quote Link to comment https://forums.phpfreaks.com/topic/55583-help-with-a-form/#findComment-274857 Share on other sites More sharing options...
We Must Design Posted June 15, 2007 Author Share Posted June 15, 2007 I am putting the ingredients into a single row using | to seperate them using explode(). The form That I am trying to create will take the users input and store it in the database as 1|7|9|7 which refer to the id of the ingredient which is held in a different table. What I dont know is how to only take the information from the combo boxes that have had a selection made. Quote Link to comment https://forums.phpfreaks.com/topic/55583-help-with-a-form/#findComment-275246 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.