How to create form fields

Sunday, November 22, 2009

Usually when a user submits the form, you need the system to do something with the data. This is where the action page comes in. The action page is the page that the form is submitted to. This page could contain advanced scripts or programming that inserts the form data into a database or emails an administrator etc.

Creating an action page is outside the scope of this tutorial. In any case, many web hosts provide scripts that can be used for action page functionality, such as emailing the webmaster whenever the form has been completed. For now, we will simply look at how to submit the form to the action page.

You nominate an action page with the action attribute.

Example HTML Code:
<form action="/html/tags/html_form_tag_action.cfm" method="get">
First name:
<input type="text" name="first_name" value="" maxlength="100" />
<br />
Last name:
<input type="text" name="last_name" value="" maxlength="100" />
<input type="submit" value="Submit" />

This results in:

First name:

Last name:

Oh, one last thing. You may have noticed the above example uses a method attribute. This attribute specifies the HTTP method to use when the form is submitted.

Possible values are:

get (the form data is appended to the URL when submitted)
post (the form data is not appended to the URL)
Providing this attribute is optional. If you don't provide it, the method will be post.


klikandri said...

but the form action to long, i wuld rather use simple text..^^

Rizky2009 said...

wes mantab tutoeialnya izin save buat praktek

Copyright © Mr.Adam
Using Mr.Adam Theme | Bloggerized by My.Blogs