HTML form element – Text field and Submit button

Posted by Shek on May 1, 2008 under HTML | Be the First to Comment | Total View: 381 views

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>

Similar Posts:

VN:F [1.9.13_1145]
Rating: 10.0/10 (1 vote cast)
VN:F [1.9.13_1145]
Rating: +1 (from 1 vote)
HTML form element - Text field and Submit button, 10.0 out of 10 based on 1 rating

Add A Comment

*