With HTML Forms We Will Present Tow Methods of Transmittion Data to the Server

Total Page:16

File Type:pdf, Size:1020Kb

With HTML Forms We Will Present Tow Methods of Transmittion Data to the Server

Server Side Programming with PHP CPAN 542

Lecture 4: Forms

In HTML forms, method represents how the data will be sent to the server (Get or Post) and action represents the URL of the program that will process the form data (for example, it might be a CGI program, ASP, JSP or servlet). Also, for post method, you can only specify an email address where the form data will be sent. For example

where [email protected] represents your email address on the HAL server. When you use forms, the method attribute specifies how the data will be transmitted to the server. Using the get method results in the data being appended to the end of the action URL after a question mark in the form: name1=value1&name2=value2&…. When post is used, the data is embedded in the HTTP request in a separate line, and it is available to a java program as standard input. get method is easer to work with since you do not need a form to debug your server side code as you can type the server side program URL and append the data to it after question mark . Get method is not recommended when the information you want to send is sensitive (like account numbers and passwords). In addition to that you are limited to 255 characters. The disadvantage of post method is that a Java applet cannot display a page or read from the post program on a host other than the applet’s host. Example: form_feedback.html In this example we will design the following feedback form: Feedback page
Title:
Name:
Phone (Optional):
Email Address:

Which format do you like the most:

Framed Frameless Tabular Framed

How would you like to receive news about my web site:

Mail Email Phone None

Please insert a short comment here:

Upload this form to your account on the HAL server and make a link from your index page to this form.

Recommended publications