Jump to content

How to get all elements of a dropdown list into a variable of type array???


hmdnawaz

Recommended Posts

I think you are going to have to try and explain more. Are you saying you have a form with a select list and you want the form to post all the values of the select list? If so, why? I would assume it is your code that created the select list so you should be able to logically determine the values that make up a select list. Plus, why have a select list of values if you don't want the user to select a value?

Link to comment
Share on other sites

I am calculating the values of dropdown list from the title field of the events table.

 

As title field may contains same names in different rows.

Suppose the title field contains "Meeting" in two different rows.Then in Meeting appears twice in my dropdown list and i want it to appears once as the name is same.

Link to comment
Share on other sites

Ideally you would have a single table to describe the individual "titles" then in the events table you would reference the title for each record using a foreign key. But, there is a simple enough solutin using what you have.

 

But, looking at your original question, I don't see any correlation in that request and your last response. Take the time to write a clear request and you will get better quality responses in a faster time.

 

One solution is to simply create a query to return the distinct title values from your table

SELECT DISTINCT title FROM events ORDER BY title

 

Or the equivalent using GROUP BY

SELECT title FROM events GROUP BY title ORDER BY title

 

Link to comment
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.