Tutorial/asp The second day of the 10 day learning ASP

Source: Internet
Author: User
Tags add variables reset variable domain name client dreamweaver

Learning purposes: Learn to transfer variables to the server using form elements, and then display the variables in the client's browser.

first, let's take a look at the Dreamweaver form elements.

form elements should be placed inside a form field, creating a form field. Then modify the file in the action as an ASP file to accept this form variable. There are two methods, one is post, the variable that the method transmits is not displayed in the browser's address bar, the data can be transmitted in large quantities, and get is displayed in the browser's address bar, and so on to give an example.

Let's take a look at the form element one at a while. 1, Text field, this is the most basic, the transmission is the text information, the general username, the password must use this transmission, but if the password must choose the password in the type, thus will replace the display character, the text domain name is very important, later will use this name therefore generally does not have the default name. Now for example: if the name of the text field is named, it is used to send the name of the online user registration, in the form field, to the reg.asp, the Post method, then in the reg.asp to get the variable if you want to show the variable, add a sentence, Response.Write Name, which forms a process from the client to the browser and back to the client. If the method is using get, change to Name=request.querystring ("name") in fact the two can be unified as Name=request ("name"). Take a look at the button, there are only two buttons, one is to submit the form of the button, one is re-enter the button. Radio button, a button has a value. In the list also, add list options and values. Here's an example, in fact, all kinds of form elements are similar. Here is the code inside the Dreamweaver:

<form name= "Form1" method= "Post" action= "reg.asp" >
Name:
<input type= "text" name= "name" >//Text field, named name
<br>
Password:
<input type= "Password" name= "PSW" >//Text field, used to enter the password, named PSW
<br>
<br>
Gender:
<input type= "Radio" name= "Sex" value= "men" >//Radio, named Sex, the value is "male"
Man
<input type= "Radio" name= "Sex" value= "female" >//Radio, the name is sex, the value is "female"
Female <br>
<br>
City:
<select name= "City" >
<option value= "Shanghai" selected> Shanghai </option>//check, everybody analyze it Yourself
<option value= "Beijing" > Beijing </option>
</select>
<br>
<input type= "Submit" Name= "submitted" value= "Submission" >//Submit button
<input type= "reset" name= "Submit2" value= "reset" >
</form>

Here's the reg.asp code to show the information you 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 the database, do you think it is easy to make a guest book?



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.