• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

Submitting Forms

Although you can use JavaScript with controls in a form in the browser and create working, complete programs, forms were originally created to let you send data back to the server. I’ll take a look at an example showing how this works here.

In this case, I’ll let the user send his name back to a Perl CGI script. (Perl, which stands for Practical Extraction and Reporting Language, is one of the popular programming languages for server-side CGI programming, and we’ll see more about it in Chapter 24.) Many CGI options are available, such as using Microsoft’s .NET framework on the server, or even using server-side JavaScript. That CGI script will create a new web page displaying the user’s name and send that web page back to the browser. To make this work, I set the form’s METHOD attribute to "POST" and ACTION attribute to the URL of the script (this is a fictitious URL):


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint