Welcome visitor
* Login
* Register
It is currently February 22nd, 2020, 10:39 am
All times are UTC [ DST ]
* Search
View unanswered posts - View active topics

FORUMS » Client Side » HTML

Post new topic Reply to topic  [ 5 posts ] 
Author Message
  Using a Form on html
PostPosted: February 4th, 2009, 6:51 pm 
User avatar

Posts: 63
Hi everybody,

Im just learning about html and stuff, and I was looking that there is a form tag that I can use to get information from the user. Can anyone help me with this please? I would like to get like a user name and a password. Thanks in advanced for any suggestion.

  Re: Using a Form on html
PostPosted: February 4th, 2009, 7:18 pm 
User avatar

Posts: 86
Yes, using the <form> tag you can get the user information, just remember that you will need a server-side file to process the information, or validate it, something like a Php file. But let us focus at this time on the client side. So on your htm document you can write something like this:

<form method="POST" action="-file that will process the info-"> //this is to open the form
<input type="text" name="-name for this var-"> //this is to enter a text
<input type="password" name="-name for this other var-"> //obviously, this is for the password

<input type="reset" value="-label for the reset button-"> //clears the info from the former fields
<input type="submit" value="-label for the submit button-"> //sends the information to the 'action' destination

And this is going to create an array with 2 vars inside of if, one containing the userName and the other the password. The method could be POST or GET, the GET one is to send the info through the URL, thats why it is not recommended when sending a password. The 'action' when left empty would mean the sameself page.

And basically this would be it for a simple user-password form on the html side, have fun ;)

  Re: Using a Form on html
PostPosted: February 4th, 2009, 7:44 pm 
User avatar

Posts: 56
Amadeus, thank you for your posting, i found it very useful, can you please explain a little more about other forms options? :D

  Re: Using a Form on html
PostPosted: February 4th, 2009, 8:10 pm 
User avatar

Posts: 86
Sure, no problem ;)

Ok, well there are a few more options in the way you can get info from the user, like radio options, checkboxes, dropdowns and text areas.

You may use the radio, for example, on selecting a 'yes' or 'no' option.
Checkboxes when the user can select more than one option or none at all.
The dropdown is useful when you want to use a small space and have many options to select from.
And text areas are used for comments or suggestions.

And this is how you can use them:

<input type="radio" name="-something-" value="for the var, lets say, yes-" checked="checked">
<input type="radio" name="-something-" value="-no-"> //the name is the same so it might be one or the other
<input type="checkbox" value="-for the var-" name="-for the var-">
<input type="checkbox" value="-for the var too-" name="-now this can be different-">
<select name="-for the var-">
      <option selected="selected">nextOption</option> //to show this as the default selected, else it would be the first one
      <option value="something diferent">thirdOption</option> //without setting a 'value', the default for this line would be 'thirdOption'
<textarea name="" cols="" rows=""></textarea> //i think i dont need to explain this line, right?

Also remember that you can remove the 'selected' option that is on the 1st line, that is just optional. If you have any further questions please let me know and i will be glad in helping out ;)

  Re: Using a Form on html
PostPosted: February 5th, 2009, 8:38 pm 

Posts: 117
Just to add to what Amadeus said. There's a bunch of style characteristics you can control about your form, to mention a few:

+ font_size
+ color
+ margin
+ background-color
+ border
+ letter-spacing

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

FORUMS » Client Side » HTML

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: