<form> element  should always have an action attribute and will usually have a and id attributes also.

actions value is the URL for the page on that server that will receive the information in the form when it is submitted.

method to get the information can either be get or post.  In the get method the value from the form are added to the end of the URL specified in the action attribute. i.e.

GET METHOD

<form action="http://lindahagen.com/subscribe.php" method="get">

   <p>This is where the form controls would appear controlled by the php program</p>

</form>

POST METHOD


This method should be used if you are uploading a file, a lot of information, sensitive data such as a password, or interacts with a database.  In the above example the method="get" would be replaced with method="replace".

id attribute should be distinct for the form on the site.

The default method if none is listed is get.

<INPUT>

The input element of forms has a type attribute such as text and a name.  The name identifies the form control. Each form control has a different name. 

type attribute 

  • type="text"  is one line of text
  • type="password" creates a text box that acts just like a single-line text input, except the characters are blocked out
  • type="radio" in addition to name there will be a value which shows next to the circle and one of the choices will have a checked="checked" attribute.  Only one radio button should have the checked attribute. <input type="radio" name="books" value="title1" checked="checked" />     <input type="radio" name="books" value="title2" />
  • type="checkbox" user can select or deselect one or more options The name should be the same for all the buttons that answer that question. The values are the words that will show on the web site <input type="checkbox" name="books" value="title1" />     <input type="checkbox" name="books" value="title2" /> Checked is not required but can be used if wanted.

example of an input statement

<form action="http://..../...php>

<p>Username:

<input type="text" name="username" />

</p>

</form>

<textarea>

<textarea> element is used to create a mutli-line text input.  Does not use the word input. Need a opening and closing tag. Any text that appears between the opening and closing tags will appear in the text box when the page load. 

<form action="http://..../...php>

<p>Was this site useful</p>

<textarea name="eval">Place comments here</textarea>

</form>

RADIO BUTTON

 

 

 

Comments (0)

500 characters remaining

Cancel or