Learning purpose: Learn to use form elements to transfer variables to the server, and then display the variables in the client's browser.
First, let's take a look at DREAMWEAVER's form elements.
Form elements should be placed inside a form field to create a form field. Then modify the file in the action to be the asp file that accepts this form variable. There are two methods, one is POST, the variables transmitted by this method will not be displayed in the browser's address bar, and data can be transmitted in large batches; GET will be displayed in the browser's address bar. I will give an example later. .
Let's look at the form elements one by one. 1. Text field, this is the most basic. It transmits text information. Generally, user names and passwords are transmitted using this field. However, if it is a password, you must select the password in the type, so that * will be used instead of the displayed characters. The name of the text field is very important. This name will be used in the future, so the default name is generally not used. Now give an example: If the name of the text field is name, it is used to transmit the name registered by the online user. In the form field, it is transmitted to reg.asp and uses the POST method. Then in reg.asp, the variable <%name is obtained like this =request.form("name")%>If you want to display variables, add another sentence, response.write name. This forms a process from the client to the browser and back to the client. If the method uses GET, then change it to name=request.querystring("name"). In fact, the two can be unified into name=request("name"). Let's take a look at the buttons. There are only two kinds of buttons, one is the button to submit the form, and the other is the button to re-enter. Radio buttons, a button has a value. Likewise inside the list, add list options and values. Here is an example. In fact, various form elements are similar. The following is the code in DREAMWEAVER:
The following is the code of reg.asp, which is used to display the information just received:
<%
name=request.form("name")
psw=request.form("psw")
sex=request.form("sex")
city=request.form("city")
response.write name
response.write psw
response.write sex
response.write city
%>
After learning about databases, do you think it is easy to make a guestbook?