Tutorials

Learn web design and programming with our free video and text tutorials.

Web Designer? Design and market your own professional website with easy-to-use tools.

How To Add a Submit Button

This tutorial shows you how to add a submit button to a form in (X)HTML.

A form needs a submit button in order to send the information entered and/or selected to the script or application that will process the information.

To create a submit button, use the input tag (<input>) with a "type" attribute with a value of "submit".

Also, because the <input> tag is a self-enclosing tag, it must have a forward slash (/) preceded by a space right before the ending bracket (>) for the web page to be XHTML standards compliant.

The form below shows you how to add a submit button to a form.

<form action="script.php" mehthod="post">

First Name:
<input type="text" name="firstname" />
<input type="submit" />
<br />
</form>

The code above produces the form below.

First Name:

You can specify the text that displays on the submit button by including the "value" attribute in the <input> tag for the submit button.

The code below shows you how to specify the text that appears on the submit button.

<form action="script.php" mehthod="post">

First Name:
<input type="text" name="firstname" />
<input type="submit" value="This is some text" />
<br />
</form>

The code above creates the form, which has a submit button with the text "This is some text".

First Name: