HTML Forms

By Prof. Fazal Rehman Shamil
Last modified on April 16th, 2020

What is the form?

The form is used to take values or data from the user and to send the data for storage in the database.

Text:

<html>
<body><form>
1st name<input type=”text” name=”1stname” value=”Sameed”>
<br>
Second name<input type=”text” name=”secondname” value=” “>
<br>
<input type=”submit” value=”Submit”>
</form></body></html>

Output:

text in html form

You can also apply input type as “password”. If you write it as follows;

<input type=”password” > 

it will create the text box  but all typed values are hidden and does not appears on the screen. Instead stars * are appears on the screen.


Radio Button:

<html>
<body><form>
<input type=”radio” value=”male” name=”gender”  > Male<br>
<input type=”radio” value=”female” name=”gender”  checked> Female<br>
</form></body>
</html>

Output:

radion button in html


Text Area:

A larger text area can also be defined to get a large message

<html>
<body><form>
<textarea name=”message”  cols=”10″ rows=”5″ >Welcome to T4Tutorials.com</textarea> <br>
<input type=”submit”>
</form></body>
</html>

Output: 

textarea in html

Select and Option

Output

Prof.Fazal Rehman Shamil (Available for Professional Discussions)
1. Message on Facebook page for discussions,
2. Video lectures on Youtube
3. Email is only for Advertisement/business enquiries.