ASP implementation and user interaction

Source: Internet
Author: User
Tags trim
Interaction

You can create a Web page like senduserinfo.htm (sending user information), where the form is implemented to send the user's name, sex, and message to ourselves, but if we only use HTML we can only give the form a <form method= "POST" Action=mailto:web@webjx.com>, we can use ASP program to realize the processing of form data in ASP. Here we just need to change <form method= "POST" action=mailto:xxx@webjx.com> to <form method= "POST" action= "userinfo.asp" > You can send the data you submitted to the userinfo.asp processing.

Of course, we should first create a database table before implementation, the table contains Username,usergender,userinfo three fields, in this do not explain the establishment of the database table, focusing on the Userinfo.asp program code.

Userinfo.asp's source code request.form ("UserName"), Request.Form ("Usergender"), Request.Form ("UserInfo"), Usergender and UserInfo are the name representations of the data to be submitted in senduserinfo.htm. You can compare senduserinfo.htm with userinfo.asp. The following is a partial explanation of Userinfo.asp's source code

<% ASP uses the VBScript language, and you can also change to a JavaScript language. %>
<%@ Language=vbscript%>

<% ' userinfo.asp

Option Explicit
Response.expires=0

Dim StrName, Strgender, STRM, STRMSG

' Get senderuserinfo.htm's name: Name= ' UserName ' transmitted data.
StrName = Trim (Request.Form ("UserName")) ' trim function is used in addition to trailing spaces

' Get Sex in senderuserinfo.htm:: Name= ' usergender ' data sent over
Strgender = Trim (Request.Form ("Usergender"))

' Get senderuserinfo.htm message:: Name= "UserInfo" sent over the data
STRM = Trim (Request.Form ("UserInfo")) ' filter out spaces in UserInfo submitted content
STRMSG = replace (Strm,vbcrlf, "<Br>" & vbCrLf) ' Replaces <Br> with vbCrLf '
%>
<HTML><BODY>

<% ' Displays the obtained data%>

Name: <%= strname%><br><br>
Sex: <%= strgender%><br><br>
Message: <Br><Br>
<%= strm%><br><br>

</BODY></HTML>



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.