HTML Old School

Input text , password

The most common input field is text and password field.

<form action="" method="POST" enctype="application/x-www-form-urlencoded">
  username: <input type="text" name="u" value="" size="5" maxlength="8">
  password: <input type="password" name="p" value="" size="5" maxlength="6">
</form>

 

 

Attributes for text and password fields are the same.

 

Attributes

1. name="string"

Defines variable name.

 

2. value="string"

Defines variable value. When submit button is clicked the name=value pair is transfered to processing script.

The value is visible inside input field.

Example: 01text_value.html

 

3. size="integer"

Defines the field width in the number of characters.

 

4. maxlength="integer"

Defines the maximum number of characters we can write into the field.

It should be maxlength < size .

 

5. readonly , disabled

readonly - disable field modifications, pass variable to the PHP script

disabled - disable field modification, don't pass variable to the PHP script

Form: 03text_disabled_readonly_php.html

PHP script: 03script.php

disabled is not visible in the URL when we use GET method: 03text_disabled_readonly_php_get.html

 

Notice that in Javascript (browser side scripts) readonly and disabled fields acts the same. Readonly and disabled pass variable to the JS code.

Example which shows that both disabled and readonly pass variable to jQuery script: 04text_disabled_readonly_js.html