Gossamer Forum
Home : Products : DBMan : Installation :

Can I do this?

Quote Reply
Can I do this?
Hi,

I need to have the following.

On the homepage I will have a Text Edit field, under that there will be a drop down menu list. The drop down list will have the options of Search By category, By Company, By Item. So a person can first enter the text they want to search, then they can choose how they want to search. Example: In the text I would write Sony, and I will choose from the drop dowm menu Company. If the user will not enter any text, it will just list all the records for Company.

------------------
JFrost




Quote Reply
Re: Can I do this? In reply to
So basically you want a little search form on your home page. No problem.

Code:
print qq|
<form action="$db_script_url" method="GET">
<input type=hidden name="db" value="$db_setup">
<input type=hidden name="uid" value="$db_uid">
<input type=text name="keyword" value="*" size=10><BR>
Sort By:
<SELECT NAME="sb">
<OPTION value="#">Category</OPTION>
<OPTION value="#">Company</OPTION>
<OPTION value="#">Item</OPTION>
</SELECT>
<INPUT TYPE="SUBMIT" NAME="view_records" VALUE="View Records"></form>
|;

Replace the # signs with the field numbers that correspond to your fields -- if Company is field 4, use

Code:
<OPTION value="4">Category</OPTION>

You can also change the label on the submit button to "Go" or whatever you want.

The reason I suggest using "keyword" as the name for the text field is that it will search on any field. And the default * means it will find all records. You might make mention of that on the form -- "The * will give you a list of all the items" or something like that.

Be aware that, if there is no match for the search, the user will be taken to the html_view_failure page, which will have the full search form on it.

I was a little confused by your statement
Quote:
If the user will not enter any text, it will just list all the records for Company.

Aren't all your records assigned to a company?


------------------
JPD