Hai,
I have created a drop down menu date which takes the system date. The problem is that i am not very sure of how i am going to put the date into the database. I have two other fields that is pm_name and project_name. This two fields i am able to get the information into the database but i am not able to do so for the date. How am i going to insert it into the database?
This is the code:-
<cfif isdefined("form.submit1">
<cfquery datasource="Producer">
INSERT into Project_Manager
(pm_name,project_name)VALUES
('#form.pm_name#','#form.project_name#')
</cfquery>
<cflocation url="menu_index.cfm" addtoken="No">
<cfelse>
<cfparam name="year" default="#year(now())#">
<cfparam name="month" default="#month(now())#">
<cfparam name="day" default="#day(now())#">
<cfset lastday=DaysInMonth(CreateDate(year,month,1))>
<cfif day GTE lastday><cfset day=lastday></cfif>
<cfset thedate=CreateDate(year,month,day)>
<cfif month EQ 12>
<cfset nextmonth=1><cfset nextyear=year+1>
<cfelse>
<cfset nextmonth=month+1><cfset nextyear=year>
</cfif>
<cfif month EQ 1>
<cfset prevmonth=12><cfset prevyear=year-1>
<cfelse>
<cfset prevmonth=month-1><cfset prevyear=year>
</cfif>
<cfset nextCalMonth="day=#day#&month=#nextmonth#&year=#nextyear#">
<cfset prevCalMonth="day=#day#&month=#prevmonth#&year=#prevyear#">
<cfset b_date_day=day>
<cfset b_date_month=month>
<cfset b_date_year=year>
------------------------------------------------------------
This is the part where the drop down menu date is
------------------------------------------------------------
<tr>
<td nowrap>
<div align="right"> <font face="Arial, Helvetica, sans-serif" size="2">
<B>Date :</b></font></div>
</td>
<td>
<cf_z_date day=#day# month=#month# year=#year# year_before=#val(year-Year(now()))# year_after=5>
</td>
<tr>
<CF_Z_DATE> is a ColdFusion tags that creates drop down list of days, months & years. The default selected date will be the the current date. There are only options of changing the (variable) name for the drop down list. The default are 'day', 'month' and 'year'.
dip.
I have created a drop down menu date which takes the system date. The problem is that i am not very sure of how i am going to put the date into the database. I have two other fields that is pm_name and project_name. This two fields i am able to get the information into the database but i am not able to do so for the date. How am i going to insert it into the database?
This is the code:-
<cfif isdefined("form.submit1">
<cfquery datasource="Producer">
INSERT into Project_Manager
(pm_name,project_name)VALUES
('#form.pm_name#','#form.project_name#')
</cfquery>
<cflocation url="menu_index.cfm" addtoken="No">
<cfelse>
<cfparam name="year" default="#year(now())#">
<cfparam name="month" default="#month(now())#">
<cfparam name="day" default="#day(now())#">
<cfset lastday=DaysInMonth(CreateDate(year,month,1))>
<cfif day GTE lastday><cfset day=lastday></cfif>
<cfset thedate=CreateDate(year,month,day)>
<cfif month EQ 12>
<cfset nextmonth=1><cfset nextyear=year+1>
<cfelse>
<cfset nextmonth=month+1><cfset nextyear=year>
</cfif>
<cfif month EQ 1>
<cfset prevmonth=12><cfset prevyear=year-1>
<cfelse>
<cfset prevmonth=month-1><cfset prevyear=year>
</cfif>
<cfset nextCalMonth="day=#day#&month=#nextmonth#&year=#nextyear#">
<cfset prevCalMonth="day=#day#&month=#prevmonth#&year=#prevyear#">
<cfset b_date_day=day>
<cfset b_date_month=month>
<cfset b_date_year=year>
------------------------------------------------------------
This is the part where the drop down menu date is
------------------------------------------------------------
<tr>
<td nowrap>
<div align="right"> <font face="Arial, Helvetica, sans-serif" size="2">
<B>Date :</b></font></div>
</td>
<td>
<cf_z_date day=#day# month=#month# year=#year# year_before=#val(year-Year(now()))# year_after=5>
</td>
<tr>
<CF_Z_DATE> is a ColdFusion tags that creates drop down list of days, months & years. The default selected date will be the the current date. There are only options of changing the (variable) name for the drop down list. The default are 'day', 'month' and 'year'.
dip.