Html form: Input Types

Posted: June 8, 2012 by makaranddalal in HTML

Radio Buttons code

  •  Radio buttons let a user select only one of a limited number of choices

<!DOCTYPE html>
<html>
<body>

<form action=””>
<input type=”radio” name=”sex” value=”male” /> I a Male<br />
<input type=”radio” name=”sex” value=”female” /> I am female
</form>

</body>
</html>


Checkboxes code

  • Checkboxes let a user select one or more options from the limited sets of Option

<!DOCTYPE html>
<html>
<body>

<form action=””>
<input type=”checkbox” name=”Subject” value=”Computer” /> Computer<br />
<input type=”checkbox” name=”Subject” value=”Electronics” /> Electronics <br />
<input type=”checkbox” name=”Subject” value=”Electrical” /> Electrical<br />
<input type=”checkbox” name=”Subject” value=”Mechanical” />Mechanical<br />
</form>

</body>
</html>


Submit Button code

  • Form data is sent to server using Submit button.
  • Form’s action attribute is used to describe the page  where data is to be sent.

<!DOCTYPE html>
<html>
<body>

<form action=””>
<input type=”button” value=”I am a button”>
</form>

</body>
</html>


Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s