Gossamer Forum
Home : Products : Gossamer Forum : Discussion :

Searching user tables via drop down boxes

Quote Reply
Searching user tables via drop down boxes

I would like to create a drop down box with a list of possible values for a column in the user table

Forinstance, one of the columns in my user table is "state". On my homepage (not /cgi-bin/gforum.cgi) but rather just my plain ole index.html i want to have a dropdown box with state selections, have the user hit "submit" and it do a query on the member directory for every user with that state - the tricky part is it must also check the value of another field.

So an example would be in the user table there is a column "owns_car" it has a value of 0 or 1 (0 no, 1 yes)

For a user to find all the other members who own a car in the state of TX I want them to be able to pull down "texas" hit "submit" and it query the member records for "owns_car = 1" AND "state=tx" The owns_car value would be hidden as the only selection the user sees is what state they want to search

how would that be done?


Quote Reply
Re: [fbm] Searching user tables via drop down boxes In reply to
*bump*
Quote Reply
Re: [fbm] Searching user tables via drop down boxes In reply to
In 1.2.1, you can do this with something like:

<input type="hidden" name="search_column" value="user_state">
<select name="search_field">....</select>
<input type="hidden" name="search_column" value="owns_car">
<input type="hidden" name="search_field" value="1">

1.2.2 has improved member directory search capabilities that will allow further customization and search parameters. My 1.2.2 announcement post will have further details on the new capabilities and how to use them.

Jason Rhinelander
Gossamer Threads
jason@gossamer-threads.com
Quote Reply
Re: [Jagerman] Searching user tables via drop down boxes In reply to
In Reply To:
1.2.2 has improved member directory search capabilities that will allow further customization and search parameters.[/quote]

That's seem nice! Will it be possible to create different users loops (search results) with any combinaison of the user columns?

It would be great if we can insert any users loop in any page of the forum.

Would it be possible to create users loops (search results) with this kind of query: show all users that [(user_date1 < $current_date) and (user_date2 > $current_date)] ?

Thank you!

François
Quote Reply
Re: [Franco] Searching user tables via drop down boxes In reply to
I'm not sure what you mean by "different user loops" - here's the semi-official writeup I have for the feature:

Enhanced member directory searching, allowing you to customize the search form on the
member directory page. Additionally, the form for user searching was moved into a
separate include template (include_user_search_form.html) to allow for easier customization.
Specifically, the search changes allow:
- user_column-opt input fields, which can contain LIKE, STARTS, ENDS, >=, <=, <, >, =, <> to
change the way user_column is searched.
- search_boolen=OR to perform a search for any matching fields, vs. the default matching all
fields
- search_whole=1 to specify that matches should match whole values rather than partial values
(i.e. "abc" should not match "zabc")
- search_column=user_column1,user_column2&search_field=searchme to search multiple columns for
the single value 'searchme'
- search_column=user_column1&search_column=user_column2&search_field=matchcol1&search_field=matchcol2
to search user_column1 for "matchcol1" and user_column2 for "matchcol2"
- search_column=user_column-gt&search_field=3 to perform a greater-than search. 'gt' can be
changed to lt, ge, le, and ne to perform less than, greater than or equal to, less than or
equal to, and not equal searches, respectively.
- search_field values may start with '!', '<', '<=', '>', or '>=' to perform not equal, less
than, less than or equal, greater than, and greater than or equal searches, respectively.

Several different examples have been added to the new include_user_search_form.html templates. To
use any of the examples, just remove the <%-- and --%> comment tags around it. Additionally, the
default search form has had a 'Number of Posts' option added to it.

Jason Rhinelander
Gossamer Threads
jason@gossamer-threads.com
Quote Reply
Re: [Jagerman] Searching user tables via drop down boxes In reply to
I think it will do all I need. Thanks! Smile