Jump to content

Help with a form...


We Must Design

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/55583-help-with-a-form/
Share on other sites

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

Link to comment
https://forums.phpfreaks.com/topic/55583-help-with-a-form/#findComment-274857
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/55583-help-with-a-form/#findComment-275246
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.