Please support our ColdFusion advertiser: Programming Forums
![]() |
•
•
Join Date: Apr 2006
Posts: 29
Reputation:
Rep Power: 3
Solved Threads: 0
I have a form set up with 3 select lists where a user can select the date. and from there I insert it into one field in an Access database using this query.
it inserts into the DB just fine, what I would like to do, is have all the information output to a form. The thing I am having problems with is getting the date to populate in 3 select lists. here is my code that I have for the select lists.
[html]
<td>Date:</td>
<td><cfparam name="form.month" default=""> <select name="Month">
<cfloop index="month" from =1 to =12 >
<cfif month EQ form.month>
<cfoutput><option value="#month#" selected>#month#</option></cfoutput>
<cfelse>
<cfoutput><option value ="#month#">#month#</option></cfoutput>
</cfif>
</cfloop>
</select>
<cfparam name="form.day" default="">
<select name="Day">
<cfloop index="day" from =1 to =31 >
<cfif day EQ form.day>
<cfoutput><option value="#day#" selected>#day#</option></cfoutput>
<cfelse>
<cfoutput><option value ="#day#">#day#</option></cfoutput>
</cfif>
</cfloop>
</select>
<cfparam name="form.year" default="">
<select name="Year">
<cfloop index="year" from =2006 to =2010 >
<cfif year EQ form.year>
<cfoutput><option value="#year#" selected>#year#</option></cfoutput>
<cfelse>
<cfoutput><option value ="#year#">#year#</option></cfoutput>
</cfif>
</cfloop>
</select></td>
[/html]
Any help would be great.
Thanks
<cfquery name="CheckDate" datasource="Rumors_Forms">
INSERT INTO BusTable (Name, Req_Date, Req_Time, Address, Email, PhoneNumber, Reason)
Values('#form.Name#', '#form.Month#/#form.Day#/#form.Year#' ,'#form.Req_Time#','#form.Address#','#form.Email#','#form.PhoneNumber#','#form.Reason#')
</cfquery>it inserts into the DB just fine, what I would like to do, is have all the information output to a form. The thing I am having problems with is getting the date to populate in 3 select lists. here is my code that I have for the select lists.
[html]
<td>Date:</td>
<td><cfparam name="form.month" default=""> <select name="Month">
<cfloop index="month" from =1 to =12 >
<cfif month EQ form.month>
<cfoutput><option value="#month#" selected>#month#</option></cfoutput>
<cfelse>
<cfoutput><option value ="#month#">#month#</option></cfoutput>
</cfif>
</cfloop>
</select>
<cfparam name="form.day" default="">
<select name="Day">
<cfloop index="day" from =1 to =31 >
<cfif day EQ form.day>
<cfoutput><option value="#day#" selected>#day#</option></cfoutput>
<cfelse>
<cfoutput><option value ="#day#">#day#</option></cfoutput>
</cfif>
</cfloop>
</select>
<cfparam name="form.year" default="">
<select name="Year">
<cfloop index="year" from =2006 to =2010 >
<cfif year EQ form.year>
<cfoutput><option value="#year#" selected>#year#</option></cfoutput>
<cfelse>
<cfoutput><option value ="#year#">#year#</option></cfoutput>
</cfif>
</cfloop>
</select></td>
[/html]
Any help would be great.
Thanks
![]() |
Similar Threads
Other Threads in the ColdFusion Forum
- test mysql query for no results (PHP)
- FILTER QUERY results on a FORM? (Visual Basic 4 / 5 / 6)
- query run successfully in sql*plus but return 0 records affected in vb6 (Visual Basic 4 / 5 / 6)
- pagination of mysql query results (PHP)
- Date format in MS Office 2000 (Visual Basic 4 / 5 / 6)
- Multiple results (MySQL)
- Dynamic Query (JSP)
Other Threads in the ColdFusion Forum
- Previous Thread: Question regarding Title
- Next Thread: loading a swf file using a variable
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)





Linear Mode