Welcome to Help4Web.co.uk - Web Design Help, Html Tutorial, Php, Asp , SQL help and CCNA, MCSE definitions!
Google
Webkpop-web.com

     Main Menu

· Home
· Free Downloads
· Computing FAQ
· Contact Us
· Free Software Downloads
· Tech Forum
· Technology News
· Web Design Help
· Your Account
· Your PM



     Web Browser


     Website Links
IT solutions
key technology solutions
Storage Area Network - Business Intelligence
Call Centre
White Papers IT
Learn Korean
Chinese Pop Music
Advertise Kpop
Korean Pop Site Map
Web Design
Pop Music
Chinese Girls
HK Pop Korean Music
Lee Hyori
Hyori
Boa Park Ji Yoon
Baby Vox YG Family
Jeon Ji Hyun
1 Tym Ha Ji Won
Shyne Bi Rain Bi
Shin Mina SM Town
Fly to the Sky
Korean Girls
Nicholas Tse
Web Traffic
보아
Edison Chen
Sung Hi Lee
Shinhwa
Andy Lau Jay Chou
White Papers
Case Study SES
Kelly Chen
Liu Yi Fei Sammi Cheng
Jordan Chan Music
IT Solutions

ASP Lesson 2:- ASP Procedures and Form Inputs

(603 reads)   



ASP Procedures
The ASP source code can contain procedures and functions:

<html>
<head>
<%
sub vbproc(num1,num2)
response.write(num1*num2)
end sub
%>
</head><body>
<p>Result: <%call vbproc(3,4)%></p>
</body></html>


Insert the <%@ language="language" %> line above the <html> tag to write procedures or functions in another scripting language than default:


<%@ language="javascript" %>
<html>
<head>
<%
function jsproc(num1,num2)
{
Response.Write(num1*num2)
}
%>
</head><body>
<p>Result: <%jsproc(3,4)%></p>
</body></html>


Differences Between VBScript and JavaScript in Asp
In ASP when calling a VBScript or a JavaScript procedure from an ASP file written in VBScript, you can use the "call" keyword followed by the procedure name. If a procedure requires parameters, the parameter list must be enclosed in parentheses when using the "call" keyword. If you omit the "call" keyword, the parameter list must not be enclosed in parentheses. If the procedure has no parameters, the parentheses are optional.

Thus in ASP, when calling a JavaScript or a VBScript procedure from an ASP file written in JavaScript, always use parentheses after the procedure name.


ASP User Input
The Request object may be used to retrieve user information from forms:

<form method="get" action="simpleform.asp">
First Name: <input type="text" name="fname">
<br />
Last Name: <input type="text" name="lname">
<br /><br />
<input type="submit" value="Submit">
</form>

User input can be retrieved in two ways: With Request.QueryString or Request.Form.


ASP Request.QueryString
The ASP Request.QueryString command is used to collect values in a form with method="get". Information sent from a form with the GET method is visible to everyone (it will be displayed in the browser's address bar) and has limits on the amount of information to send.

If a user typed "Bill" and "Gates" in the form example above, the URL sent to the server would look like this:

http://compbuy.co.uk/webdesign/simpleform.asp?fname=Bill&lname=Gates

Assume that the ASP file "simpleform.asp" contains the following script:

<body>
Welcome
<%
response.write(request.querystring("fname"))
response.write(" " & request.querystring("lname"))
%>
</body>


ASP Request.Form
The ASP Request.Form command is used to collect values in a form with method="post". Information sent from a form with the POST method is invisible to others and has no limits on the amount of information to send.

If a user typed "Bill" and "Gates" in the form example above, the URL sent to the server would look like this:

http://compbuy.co.uk/webdesign/simpleform.asp

Assume that the ASP file "simpleform.asp" contains the following script:

<body>
Welcome
<%
response.write(request.form("fname"))
response.write(" " & request.form("lname"))
%>
</body>

 


ASP Form Validation
User input should be validated on the browser whenever possible (by client scripts). Browser validation is faster and you reduce the server load.

You should consider using server validation if the user input will be inserted into a database. A good way to validate a form on the server is to post the form to itself, instead of jumping to a different page. The user will then get the error messages on the same page as the form. This makes it easier to discover the error.

  

[ Back to Asp Help | Web Help Index ]






CISSP | CCNA | TFT | WEP | VBScript | Server
Jpop
Kpop
Learn Chinese
Learn cantonese
Sim Free Mobile Learn Mandarin
Kaila yu
Utada Hikaru
Jet Li
Twins HK
Kelly Hu
Aaron Kwok Joey Yung
Maia Lee
Chinese Singles
Andy Lau
Sammi Cheng
JackieCheung
Nicholas Tse
Jay Zhou
Jordan Chan
Kelly Chen
Joey Yung
Park Ji Yoon
SES
Shinhwa
Shin Mina
Shyne
SM Town
DBSK TVXQ
Sung Hi Lee
T Tasha
U;nee
Yoo Seung Jun
Won Bin
YG Family
Korean Girls
Korean Wife
Korean Dating
Korean Husband
Korean Singles
Se7en
Epik High
FinKL
Kpop Banners
1 Tym
BabyVox
Bae Yong Jun
Bi Rain / Rain
International Sim Card
Boa
Click-B
Fly to the Sky
GOD
Ha Ji Won
Hyori

Jang Nara
Jeon Ji Hyun
JTL
Papaya
Lee Soo Young
Grace Park
Se7en
Kpop Kim Hee Sun
Won Bin
Korean Singles
Bae Yong Jun
Speak Korean
Jang Nara
SES
YG Family
Chae Yeon
Detox Patch
Detox
Party Promoter
Phone Card
RHUL
Web Tutorial
Programming
Loans UK
BokuMaro
CV Help Book
Chinese Music
Liu Yi Fei
Edison Chen
Andy Lau
Alyssa Chia
Avril Lavigne
Sean Pau
Kylie Minogue
Dan Truong
Uk Chinese
Chinese Models
Music
Learn Korean
Japanese Girls
Memory Card
CCNA definitions
Freelance Jobs

Produced by Kpop-Web Design Associates, all rights not reserved.
Computer Programming with Internet Marketing and Search Engine Optimisation Software Defined Radio | Loans UK | Phil Leung Here are some sites with current affiliates and partner to our sites, they are recommended however we accept no responsibility for the content which they may contain. Printing | Kpop | Web Guide | Kpop | Korean Music 1 | Korean Music 2 | Korean Music 3 | IT White Paper | CV Help | Server Definition | Firewall | White Papaers | Case Study | Web Cast | Research Paper