Form Submission – Action

Posted by admin | Posted in HTML Tutorial | Posted on 11-08-2010-05-2008

0

For a submission button to accomplish anything it must be placed inside of a form tag with an action and a method. The action is always set to a server side scripting file such as a PHP, PERL, or ASP file. Another choice may be to set the action to mailto followed by an email address, and the form will be emailed to the specified address.

Mailto has been depreciated, however for the purpose of this example and to get a feel for form submission, it will work great in our example.

Example:

  • <form method=”post” action=”mailto:youremail@youremail.com” >
  • First:<input name=”First” size=”12 maxlength=”12″ />
  • Last:<input size=”24″ maxlength=”24″ />
  • <input value=”Send Email” />
  • </form>

Form Action:

First:
Last:
Fill out the above form and as your mail program opens, you can change the email address to your email and then send yourself the results of your form.

HTML Reset Buttons

Reset button is yet another button, but is not much linked with the server or the scripting.Setting the type to reset will place a button within your form to reset each field when clicked.

For example a wrong entry is made and you want to start it all again then you can click on this button and start over again.

Example:

  • <input value=”Reset Fields” />
  • <input value=”Start Over” />

Reset Buttons:

Reset buttons exist to reset the fields of your form. These are handy for very large forms and the user is having difficulty or simply needs to start filling in the form from scratch.

HTML Reset in Action

To actually make submit and reset buttons function with your other input fields. They need to be placed within a form tag. HTML Forms has some great examples of how to use the form tag properly.

Example:

  • <form action=”myphp.php” method=”post”>
  • <input size=”12″ maxlength=”12″ />
  • <input size=”24″ maxlength=”24″ />
  • <input value=”Reset” />
  • </form>

Reset Forms:

Summary of Form Tags

Tag Description
<form> Defines a form for user input
<input> Defines an input field
<textarea> Defines a text-area (a multi-line text input control)
<label> Defines a label to a control
<fieldset> Defines a fieldset
<legend> Defines a caption for a fieldset
<select> Defines a selectable list (a drop-down box)
<optgroup> Defines an option group
<option> Defines an option in the drop-down box
<button> Defines a push button
<isindex> Deprecated. Use <input> instead

Write a comment

Twitter Users
Enter your personal information in the form or sign in with your Twitter account by clicking the button below.