Web Design Resources Blog Logo: Offering The Best of the Web Links to Graphic Design, Web Design, and Graphics Websites and Resources in a Web Blog Journal all web design resources bottom number 2

Web allwebdesignresources.com
contact all web design resources top number 3
all web design resources bottom number 1 all web design resources bottom number 2 all web design resources bottom number 3

AllWebDesignResources.com is the Web Design Directory & Blog of the Graphic Design Resources Directory Listing The Best of Web Design Resources, Tools, Graphics Software, Web Design Websites, Reviews, Articles, Commentaries, Advice, & Tutorials on Web Design & Development Topics.

contact allwebdesignresources.com contact allwebdesignresources.com
Graphic Design Resources Ads Separator - Graphic Design & Graphics Templates Below this Arrow
home > Web Design Tutorials > Programming Tutorials > ASP Coding Tutorials > ASP Variables and Forms Tutorials  
 

ASP VARIABLES TUTORIALS : ASP FORMS TUTORIALS & LESSONS

Planet Source Code - VarsFromForm - This subroutine creates a variable for each form item found on Request.Forms or Request.QueryString collections. The variable is given the same name as the form items name.

ASP 101 - Functions for Passing Variable - you're coming here directly and haven't read A Pair of Functions for Multi-Page Forms, you should do so now so you know what you're getting into. What follows is a set of extremely helpful code that should make your life a lot easier.


Variable Types Sample
This is a variable types sample article. Just when you though all variables were the same and you had finally figured the variant out--they pull you back in with variant sub-types.

Variable Name Prefixes - Good ASP code is easy to read and understand. A quick way to make your code self-documenting is to name your variables in a meaningful way. The IIS Resource Kit team has put together a list of variable name prefixes to be used with assorted data types. Using them will not only make your code easy to read, but it will also have a professional feel.

Scope out your variables
In ASP, script- or page-level variables are available across all of the code on any page for the lifetime of that page. These variables are declared outside the scope of any particular procedure or function. Procedure-level variables, on the other hand, are declared within a function or procedure and are available only within the scope of that function. That means you can access the value in the variable only within the context of its function or procedure. The code below demonstrates how to declare both script- and procedure-level variables:

Dim Even When Not Using Option Explicit - If for any reason you ever find yourself not using Option Explicit (IE: maintaining someone else's old code), you should still dimension all the variables you use. A dimensioned variable works almost twice as fast as an implicitly created variable.

 

Planet Source Code - VarsFromForm - This code formats the values returned by the Request object. It is not meant to replace validation in your forms but assist in converting balnk strings, null values, etc. to the proper data type for saving.

Planet Source Code - Dynamically Generate Variables - The purpose of this application is to make it easier to capture data from forms. I decided to write a way to dynamically create the request which strip the variable for apostrophes and also trims the variable

Planet Source Code - Hex Viewer
- Allows you to view the binary data of any file (GIF, JPG, ZIP, TXT, HTM, ASP) as if you were looking at a common hex viewer. Bytes are displayed as Hex characters and character data is displayed on the right.

Codefixer - Variables in ASP (VBScript) - A variable acts as a container holding or storing a value in the server computer's memory. We can then use or change the value of the variable throughout our code. Thus we could create a variable myFavouriteTeam that holds my favourite football team namely 'Spurs' and print out the value of the variable on our page. Note that to declare a variable in ASP/VBScript we use the Dim statement.

The basics of variables in ASP - Variables are vital in most every ASP script. Lets start out with the syntax for declaring a variable within a script.

Server variables - The available Server Variables vary based on the result of a combination of the browser software and the server software. They are not always exactly the same on your server and with specific browsers as documented here. There is an easy way to obtain a list. If the script is executed on a given browser, the Server Variables displayed will reflect that browser plus your server.

Code Snippet - List all session variables - This script lists all of the session variables and what the value of each session variable is in real time on your domain.

Fun with Application Variables - The following tutorial will show a simple method for setting and using Application Variables. These variables are a life saver when it comes to writing long drawn out applications that require alot of the same recordset results.

View All Variables - This single ASP page will list down all site variables. It will list down Server variables, Application variables, session variables, cookies and ASP/IIS Engine details. Very helpful for debugging.

How to get server variables - Server variables are environment variables that tell you about the environment that your application is running in. True you can find all kinds of information in the server variables.

W3Schools - ASP Variables
If the variable is declared outside a procedure it can be changed by any script in the ASP file. If the variable is declared inside a procedure, it is created and destroyed every time the procedure is executed.

Client Variable To Server - Need to get a variable from client to server? this first visit to the page has an empty string for tPass variable, after the user clicks the submit button the page re-loads itself but this time, with tPass holding a value the user enters

Server Variables Sample
The server variables ("ServerVariables") collection can be very helpful when you are developing ASP applications. As you have probably noticed in some of the other sample applications on this site, you can use the server variables collection to determine the client's browser, IP address, the current page they are viewing, the page which referred them to the current page, and many other details. The sample application(code below) listed here is a very simple app which lists all of the server variables and their current values. Note that this information varies depending on what server you are using. IIS4 has many additional variables not included in IIS3. The proper syntax to refer to a server variable in your code is Request.ServerVariables("VariableName").

 

SUBMIT YOUR WEB DESIGN, GRAPHIC DESIGN, or FREELANCE ARTICLE or TUTORIAL

We are looking for quality submissions of Web Design, Graphic Design, Freelancing, and Small Business Articles & Tutorials. Our network of sites gets about 20,000 visitors per day. If you are interested in promoting yourself or your business, then this is a great way to do so. We might also use it in our Graphic Design Blog and our Web Design Blog. Please submit your articles to us. You can send us your article in MS Word Format or HTML. Please email us with any questions.

BOOKMARK THIS PAGE! :: MAKE US HOMEPAGE  :: SIGN UP NEWSLETTER :: ADD PORTFOLIO FREE :: DESIGNER JOBS :: FREELANCER JOBS

OUR FRIENDS -- Adobe Photoshop Tutorials --Photoshop, Flash, 3D Studio Max Tutorials --Photoshop Tutorial Man -- Tutorial Guide -- Free Webmaster Tutorials -- AllFreelanceWork--AllFreelance--Artists Helping Children -- All Creative Portfolios -- All Work at Home Ideas

R E L A T E D . L I N K S

All website design, text, graphics, selection and arrangement thereof, and software are the copyrighted works of Allfreelance, © Copyright 1997-2006. Contact Us