Gjslick, I am currently attached to an organisation by my school, this organisation is running on intranet so i can only scan you the code.. hope you dont mind. HAHAHA i just found out that i can save what i scan into txt file with adobe =D
everything is done in this page, item consist of
:a form for user to input search
:SQL for filter
:a form table for displaying result
why i want a form for displaying result is because user can select on the result name. therefore i need a input for user to select.
problem:
my sql is not working. it says that textboxname from form is undefined. why?
searchdb_dir.cfm
Code:
<!--this is search table -->
<form name="searchdir" action="searchdb_dir.cfm" method="post">
<table width="800" height="50" align="center">
<tr>
<td width="179" align="left" valign="top">
search Date:<br>
<input type="text" readonly
value="<cfoutput>#Dateformat(date_now,"d/m/yyyy")#</cfoutput>" name="txtDate_dir"><img src="pics/cal.gif" style="cursor:pointer" onclick="opncal('txtDate_dir')">
</td>
<td width="179" valign="top">
Date from:<br>
<input type="text" readonly name="txtDateFrom_dir"><img src="pics/cal.gif" style="cursor:pointer" onclick="opncal('txtDateFrom_dir')">
</td>
<td width="179" valign="top">
Date to:<br>
<input type="text" readonly name="txtDateTo_dir"><img src="pics/cal.gif"style="cursor:pointer" onclick="opncal('txtDateTo_dir')">
</td>
<td width="171" valign="top">
project Name:<br>
<input type="text" name="txtproj">
</td>
<td width="68" align="center">
<input type="submit" name="searchBtn" value="search">
</td>
</tr>
</table>
</form>
<!--SQL for filter -->
<cfquery name="DIRdata" datasource="DBcadcam">
SELECT projectName, count(*) as NumofRequest, sum(NumofDrawing) as totalqty
FROM DIR
WHERE
DateRequested Like ,#txtDate#
<cfif #txtDateFrom_dir# is not "">AND DateRequested >= #createODBCdate(form.txtDateFrom_dir)#</cfif>
<cfif #form.txtDateTo_dir# is not "">AND DateRequested <= #createODBCdate(form.txtDateTo_dir)#</cfif>
GROUPBY projectName
</cfquery>
<!--display table -->
<form name="formtable" action="" method="">
<tablewidth="10" align="center" bgcolor="#FFFFCC" frame="box">
<thead bgcolor="#66FFCC">
<tr>
<td width="SO" ali~n="center">s/N</td>
<td width="1??" allgn="center">project Name</td>
<td width="188">Total number of Drawing</td>
<td width="188">Number of Request</td>
</tr>
</thead>
<cfoutput query="DIRdata">
<tr>
<td align="center">#DIRdata.currentrow#</td>
<td align="center">
<input type="hidden" name="ProiectName" value="#projectName#">
<input type="hidden" name="DIRT. value="dir"><a "href='dir_detail.cfm?DIR=dir&projectName=#projectName# name="selected" id="selected" target="_blank">#projectName#</a>
</td>
<td>#totalqty#</td>
<td>#NumofRequest#</td>
</tr>
</cfoutput>
</table>
</form>