Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.