Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Using a Form to selct from DB

Community Beginner ,
Mar 26, 2009 Mar 26, 2009
Need Help...

Please take a look at this site page and please advise as to which Cold Fusion record set would be the one to use and how. The page is http://www.condraartista.com/select.asp as you can see it is written in active server pages. The result page looks like this http://www.condraartista.com/search.asp.

My database is Microsoft Access 2007

I have been trying so hard in finding the right combination with video tutorial etc. But I gues becuase the form has drop down selectors it seems difficult.

Anyone that can provide assistance is welcomed and appreciated.

R/S

Armando O Ortiz
TOPICS
Database access
1.0K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 26, 2009 Mar 26, 2009
there are numerous ways a search form like that can be coded using cf
(or any other language for that matter). which part of creating a search
form are you having trouble with exactly?

just as general examples, here's some sample code:

1) hard-coded search form:
<!--- search form --->
<form ...>
<select name="gender">
<option value="0" selected="selected">Any</option>
<option value="Female">Female</option>
<option value="Male">Male</option>
</select>
...
</form>

<!--- results page --->
<cfparam name="form.gender" default="0">
<cfquery name="getSearchResults" datasourse="...">
SELECT somecolumns
FROM sometable
WHERE 1 = 1
<cfif form.gender neq 0>
AND gender = <cfqueryparam cfsqltype="cf_sql_varchar" value="#form.gender#">
</cfif>


2) database-driven search form:
<!--- search form --->
<cfquery name="getGenders" datasource="...">
SELECT 0 AS gender_id, 'Any' AS gender, 1 AS sortcolumn
FROM genders
UNION
SELECT gender_id, gender, 2 AS sortcolumn
FROM genderstable
ORDER BY sortcolumn, gender
</cfquery>

<form ...>
<select name="gender">
<cfoutput query="getGenders">
<option value="#gender_id#" <cfif getGenders.currentrow eq
1>selected="selected"</cfif>>#gender#</option>
</select>

<!--- results page --->
<cfparam name="form.gender" default="0">
<cfquery name="getSearchResults" datasourse="...">
SELECT somecolumns
FROM sometable
WHERE 1 = 1
<cfif form.gender gt 0>
AND gender = <cfqueryparam cfsqltype="cf_sql_integer" value="#form.gender#">
</cfif>


the above examples are just 2 of multitude of possible ways to go about
it...

hth


Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Mar 29, 2009 Mar 29, 2009
Thank you for responding. I am still stuck. I am also new to Cold Fusion or any dynamic building.
I would like to know how the recordset/s need to be made in order to retrieve all the choices that are selected on the form and displayed. Do you have to create a recordset for each drop down choice or is there a way to create a recordset that will choose all the choices and then just click on the submit button and then on another page see all the talent persons you chose?

Please advise...Thanks

Armando.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 29, 2009 Mar 29, 2009
quote:

Originally posted by: Armandotop
Thank you for responding. I am still stuck. I am also new to Cold Fusion or any dynamic building.
I would like to know how the recordset/s need to be made in order to retrieve all the choices that are selected on the form and displayed. Do you have to create a recordset for each drop down choice or is there a way to create a recordset that will choose all the choices and then just click on the submit button and then on another page see all the talent persons you chose?

Please advise...Thanks

Armando.

There are many beginner level tutorials on easycfm.com. Try some of them and you'll get the hang of things.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Mar 31, 2009 Mar 31, 2009
Thank you for responding. I am mainly stuck on the Submit button area. Where the form has drop downs to select then once you selcted then you click on the submit button to retrieve from the data base what you ahd selected.

I need to know how the recordset is laid out for each drop down. Once each drop down has been set up with the appropriate recordset then you would click on the submit button to retrieve the selections.

Could you create the recordset that is needed for each drop down of the form on the URL http://www.condraartista.com/select.asp . Pl;ease advise and Thank You once again.

R/S
Armando
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 01, 2009 Apr 01, 2009
LATEST
quote:

Originally posted by: Armandotop

I need to know how the recordset is laid out for each drop down. Once each drop down has been set up with the appropriate recordset then you would click on the submit button to retrieve the selections.


R/S
Armando

If I understand your question correctly, the answer resembles this:

<cfquery name="q1">
select id, description
from etc
</cfquery>

<cfform>
<cfselect name="something" query="q1" value="id" display="description">


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources