close ad
WARNING: Do Not Install the DREAMWEAVER CC 2017 or 2018 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

multiple criteria selection

Thread began 2/05/2010 2:42 am by erikpost371097 | Last modified 2/07/2010 2:26 pm by erikpost371097 | 1030 views | 2 replies |

erikpost371097

multiple criteria selection

In my table of contacts, all contacts have a category (=numeric value). Now I want to be able to select contacts in one or more categories (for instance "Family"+ "Team mates" + "Colleagues", "Team mates" + "Colleagues" or "Family" only).

For this, I made in Dreamweaver a selection page with a select list.
In this list, the names of my categories appear, and the corresponding value is selected when the category is selected.

The resulting value of the select list is send with $_POST['result'] to the next page. So far, no problem. I need some help however in using $_POST['result'] in my MySQL statement.

I tried ...WHERE r_categorie in ($_POST['result']).... This works fine when only one contact category is selected.
When more categories are selected, this WHERE clause gives only the last one that was selected in the select list.

What should I change? Is the select list the most appropriate way of making the selection (knowing that the category list is dynamic)?

Any help will be greatly appreciated.

Kind regards,

Erik

Sign in to reply to this post

Jason ByrnesWebAssist

To have a multiple select list pass all values that where selected in PHP, you must name the select list with "[]" at the end of the name to create an array. For example:
<select name="result[]" size="4" multiple id="result[]">


To get the values out of the array, you need to use the php implode function:
<?php echo(implode(", ", $_POST['result'])); ?>


your recordset SQL would need to be:

WHERE r_categorie in(".implode(",", $_POST['result']).")

Sign in to reply to this post

erikpost371097

It works

Jason, thanks a lot. This did the trick and it works fine now.

Kind regards,

Erik

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...