cookieChoices = {};

Sunday 21 July 2013

FORM TAG

FORM Tag:


<form action="URL" method="post"..>

  <input name="n1" type="text/password/submit/reset/button/checkbox/radio/hidden/file/image"..>
  <textarea name="t1"/>
.......................
.....................
</form>

Notes:
  1. Form tag cannot be nested inside another form tag.
  2. Input type's Button and Reset and Disabled elements name and value pairs is not submitted to the server.
  3. Input  type="button" is used only for writing client side JavaScript code.
  4. Input type="Checkbox" submits name and value pairs only if checkbox is checked otherwise nothing is submitted. If value is not provided the default value posted is "on".
  5. To group radio buttons , same name must be given to them. And only the name-value pair of radio-button selected will be submitted to server.
  6. For the select, name of select and value of the option selected is submitted to server.
  7. select tag with size attribute is rendered as Listbox otherwise its rendered as DropDown list.
  8. If multiple options are selected in list box , then with same name different values are submitted to server.
  9. For Textarea, name of text area and value of textarea is submitted to server.
  10. Input type="Image" behaves as submit button where as <img> tag renders as static image.

What is ASP?


What is ASP?

  • ASP is server side scripting technology that enables scripts (embedded in web pages) to be executed by an Internet server.
  • An Asp file can contain HTML,XML, and Scripts.
  • An Asp file has the extension ".asp".
  • when the browser requests an html file , the server just returns the file without doing any processing.
  • when the  browser requests an ASP file, IIS passes the request to the ASP engine (ASP.DLL ) on the server.
  • The ASP engine reads the file , line by line , and executed the scripts in the file which is marked as server script in <%  %>
  • Finally , the output rendered is returned to the browser as plain HTML.
ASP Objects: Request , Response , Session, Application , Server, ObjectContext & AspError.

<%......%> It contain the server code in VB script. The code out side the delimiter is client side code and is as it is rendered to the client.

<% Response.Write ("hello") %> or <%= "hello" %> are Same.


Get and Post Methods

GET Method:

  1. All the name value pairs are submitted as query string.
  2. Its not secured as it is  visible in plain text format in the location bar of the web browser.
  3. Length of the string is Restricted.
  4. If the method is not mentioned in the form tag , this is th default method used.
  5. If the get method is used and if the page refreshed it would not prompt before the request is submittted again.

POST Method:

  1. All the name value pairs are submitted in the Message Body Of the Request.
  2. Length of the string is Not Restricted.
  3. Post Method is Secured because Name-Value Pairs cannot be seen in location bar of the web server.
  4. If the Post method is used and if the page refreshed it would  prompt before the request is submittted again.

Get and Post Methods

GET Method:

HTTP Protocol

HTTP Protocol:
  • ·         The communication between web server and web browser on internet is done using HTTP Protocol.
  • ·         HTTP is W3C specification.
  • ·         HTTP Protocol is safest protocol on internet.
  • ·         HTTP is stateless protocol .This is because it does not know whether the request that has been  made is part of an ongoing correspondence or just a single message.
  • ·          HTTP Communicates only in string Format and is thus virus free and is platform independent.
  • ·          HTTP Protocol works on PULL technology. i.e , we can pull everything available on web server but  we cannot push content to server unless server allows for it.

HTTP Request Structure (Browser->Server)          HTTP Response Structure (Server->Browser)

  1. Request Line                                                              1.Status Line
  2. Request Header                                                         2.Response Header
  3. Message Body(Posted data)                                      3.Message Body(Page Content)


Request Line: Method Path protocol / version
Example :    Get Demo/default.htm http/1.1

Request Header: These are the name value pairs submitted by the browser to server. It contains the informatin about the browser and the OS on the client machine.

Message Body: is the stream of name value pairs submitted to server when the form is submitted using the POST .

CGI Environment Variables:

Its a collection of name value pairs including request headers and information about the server in a context of a given request. The names of these variables are based on CGI(Common Gateway Interface) specification. These are also reffered as SERVER VARIABLES.

<form name="form1" action="demo.asp" method="post">
           <input type=".......
           <input type="submit" name="s1" value="submit">
</form>

when the form is submitted by clicking on the submit button it submits the Name/Value pair of every input element in the form to the server.