Passing form data to server

The GET method

In the GET method the parameters are passing as a part of the URL. They are attached to the script URL (provided as the "ACTION" parameter) after the "?" symbol. The parameters appear in pairs "name=value" separated by "&", where name is the parameter name and value is the parameter value, as it appears in the form. Any space in the form will be encoded as "+". Any "plus" symbol (and other control characters) will get a hexadecimal encoding preceded by "%" by using the standard URL encoding.

The parameter string itself is passed to the CGI script by setting the enviromental variable QUERY_STRING (in Unix/Linux systems).

Type something in the fields below and check how it works. The CGI script returns you the parameter string QUERY_STRING. Some programming is needed to extract the value of a particular parameter from this string.

FormHTML tags
Username:
Password:
<form method="get" action="/cgi-bin/sb/CheckData">
<table>
<tr><td><Username:</td> <td><input name="username" /></td></tr>
<tr><td><Password:</td> <td><input name="password" type="password" /></td></tr>
<tr><td><input type="submit" value="Submit" /></td>
    <td><input type="reset" /></td></tr>
</table>
</form>

The POST method

In the POST method the parameters are passing to the CGI script as a standard input. As in the Get method, the parameters appear in pairs "name=value" separated by "&", where name is the parameter name and value is its value, as it appears in the form. Any space in the form will be encoded as "+" and any plus symbol will get a hexadecimal encoding preceded by "%" (the URL encoding).

Type something in the fields below and check how it works. The CGI script returns you the parameter string taken from the standard input. Some programming is needed to extract the value of a particular parameter from this string.

FormHTML tags
Username:
Password:
<form method="post" action="/cgi-bin/sb/CheckData">
<table>
<tr><td><Username:</td> <td><input name="username" /></td></tr>
<tr><td><Password:</td> <td><input name="password" type="password" /></td></tr>
<tr><td><input type="submit" value="Submit" /></td>
    <td><input type="reset" /></td></tr>
</table>
</form>

As you see, the only difference between the two HTML scripts is the value of parameter method in the form declaration.