HTML Submit Buttons (HTML Forms tutorials part 9)

১১/১৮/২০১১ ০৯:২৩:০০ AM | | 0 comments »

Submission buttons are a type of <input /> tag. Set the type attribute to submit. This creates a special type of button in your forms that will perfom the form's set action. We learned about the action attribute in our HTML Forms lesson.

HTML Code:

<input type="submit" value="Submit" /><br />
<input type="submit" value="Send" /><br />
<input type="submit" value="Submit Form" /><br />

Submit Buttons:



Notice that in the above example we also changed what was written on our button using the value attribute. This can be changed to any value you wish.

Form Submission - Action

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.

HTML Code:

<form method="post" action="mailto:youremail@youremail.com" >
First:<input type="text" name="First" size="12 maxlength="12" />
Last:<input type="text" name="Last" size="24" maxlength="24" />
<input type="submit" 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.