HTML's form basic knowledge consists of two parts, part of the HTML page, is what the user can see. Another part is a program running on the server. In general, let's first HTML page, some programs. So our learning page is this, first look at the form of writing, then learn the CGI program. For HTML forms, there is a complicated and detailed regulations. But because they are things belong to the HTML standard, I don't plan to explain in detail. It is best to find a book yourself. The HTML form
last name: Department: Accounting Administration Engineering sales select> pre> form> this The form has two inputs: LastName and Department. Users can enter the name in the text box and select a department from the selection list. Each Option tab is provided to a user an option. When the submission button is clicked, the file specified by the Action property will be opened, and the FORM variable is passed to the file as a dynamic parameter. Suppose the user entered the name "Peterson" and selected "Sales". When she clicks on the submission button, the following FORM variable will be passed to the file Employesearch.cfm: lastname = petersondepartment = sales set the action attribute and method attribute you have to set the form of the action, tell the flowchart When the user clicks the submit button Which file is called when calling. You must also set the Method property of the form to POST. In the following example, when the user clicks the submit button, call the Employesearch.cfm file. Implementing the data query field is very simple to establish a query field for the form. You only need to establish a form query field for the database field you want to search. In order to make the files have better readability, you can have the same name as the database field with the database field.
For example, if you have a table Employees, there are three fields of firstname, lastname, and department, and your form field can be: name: Lastname: Department: URL parameter REQUSTTIMEOUT When requesting a ColdFusion file, you can pass the RequestTimeout parameter in the URL, specify the number of seconds of the data source connection timeout To prevent a data source connection takes too much time. This parameter will override the default value in the ColdFusion Administrator.
The syntax used is: http: //myserver.com/cfpages? RequestTIMEOUT = 100 example: Dynamic SQL The following file SearchForm.cfm established a query form:
Employe Search Title> Head> last name: department: Accounting Administration Engineering Sales select> pre> form> body> html> When the user clicks the submission button, the following file Employesearch.cfm is used to select and display the query result: < Cfquery name = "Employeelist" Datasource = "CompanyDB"> Select * from Employeeswhere Lastname =? Lastname # and divartment =? Department # cfQuery> Employee Search Results title> head> Organization Search Results h2> the search for #form .Lastname # Inthe # form.Department # Returned these results: p> cfoutput> <--- display results ---> # firstname # # lastname # (Phone: # phoneenumber #) cfoutput> Thank you for searching the Employee Database! p>
body> html> pattern matching query When you allow users to enter text as part of query conditions, you usually do not want to query the value that fully matches the input, you usually need to query Enter a similar value for text. In this case, you can use the pattern matching query.