HTML form element – Text field and Submit button
HTML form element – text field, as its name says, it is for inputting texts, examples like name, age or password.
The code for the text field within a HTML form is like this:
1 2 3 | <form name="form1" method="post" action="test.php"> <input type="text" name="textfield1" /> </form> |
The code above would generate a form and a text field named “textfield1″:
To sent the text to a PHP file, test.php for example, we need a submit button, the codes of the submit button are:
<input type="submit" name="Submit" value="submit"/>There are 3 attributes for the submit button:
- type: to tell what nature it is, in this case is a submit button, then we use submit for type.
- name: to give the element a name.
- value: the text shows on the button.
To combine all elements into the form and we get:
1 2 3 4 | <form name="form1" method="post" action="test.php"> <input type="text" name="textfield1"/> <input type="submit" name="Submit" value="submit"/> </form> |





Add A Comment