PHPSuperBlog.com

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:

<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:

<form name="form1" method="post" action="test.php">
<input type="text" name="textfield1"/>
<input type="submit" name="Submit" value="submit"/>
</form>

VN:F [1.9.3_1094]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.3_1094]
Rating: 0 (from 0 votes)

Similar Posts:

Leave a comment