Roots
Back

Form Buttons

How to add a reset button

You've already encountered a submit button, but a reset button is useful as well, in case the person filling in the form needs to start over.

<input type="reset" value="text">

text - The name of the button. For example;

<form action="form-process.php" method="get">
Name: <input type="text" name="username" maxlength="10" value="your name"><br>
Email: <input type="text" name="email" value="email@domain.com"><br>
<input type="submit" value="Submit"> <input type="reset" value="Reset">
</form>

Name:
Email:


How to use an image as a button

You can also set an image to use instead of the default grey button.

<input type="image" src="url" height="value / percenage" width="value / percentage" alt="text">

url - The full or relative address of the image to use as a button.
value - The width or height in pixels of the image.
percentage - The width or height of the image, as a percentage of the containing element.
text - The alternative text to display if the image cannot be shown.

For example;

<form action="form-process.php" method="get">
Name: <input type="text" name="username" maxlength="10" value="your name"><br>
Email: <input type="text" name="email" value="email@domain.com"><br>
<input type="image" src="images/submit-button.gif" height="25px" width="80px" alt="Submit">
</form>

Name:
Email: