How to send these forms

How to send these forms

Sending data from the form filled with the visitor of the website - one of the most often solvable problems of interactive interaction of the web surfer with server programs of this resource. The organization of this operation in the source code of the page of the hypertext is much simpler, than creation of scripts for processing of transmitted data. It can be implemented as means of the HTML language, and with use of JavaScript-scripts.

Instruction

1. If data processing is carried out not in the same file which forms the page with a form, surely specify the script processor address in the action attribute. Set one of two possible methods of sending variables of a form - Get or Post. The choice depends on that which of them is used for reading variables by a script. In principle, it is enough for the solution of an objective, it is not obligatory to place in a form the special element initiating sending of information as pressing Enter is by default equivalent to click on the button of sending data. However not any user will guess it therefore it is more preferable to place the corresponding button in a form.

2. Use the button which is formed by the input tag with submit value in the type attribute. Clicking of such button - the "classical", most often used method of the organization of sending data from a form in the web page. Except the type attribute it is desirable to specify value of the name attribute, and it is possible to place the text of an inscription on the button in value. For example: <Send input type= "" submit"" name= "" suBut"" of value= ""!""/>

3. It is possible to use the JavaScript-script for sending data. It can be useful when it is required to organize automatic sending on any event - for example, after the choice by the user of the necessary value in a drop-down list or if before sending information it should be checked by the JavaScript-validator. For implementation of such way of sending of data use form object submit method. Let's tell if in the name attribute of a form the UniForm value is written, then for simulation of clicking of the button of sending data to the JavaScript code after all necessary actions with the values entered by the user it is necessary to place such line: document.UniForm.submit ();

Author: «MirrorInfo» Dream Team


Print