SlideShare ist ein Scribd-Unternehmen logo
1 von 19
HTML Tutorial Part 4
Welcome Again all,
Today I am Going To Start New Topic
Very Very Important as a Web Developer
For HTML which covers Forms.
Let sStart...’
Topic
● Form Elements select and Text Area
● Input Elements
● Input Elements Attributes
Form Elements
● Form elements are such element which we used for creating
our HTML form like Some Elements input box,dropdown
select,Buttons,Textarea.
• Input Box – For Simple input of data in any format.
• Select Dropdown – For Selecting Item in a list of items
• textarea – For Large Area of Input Contents ,Description
Message which is used to display our data in also multiline.
• Button – For Submit our Form or Simple Button For Any Events.
Form Elements
List of Form Elements.
● <form>
● <select>
● <input>
● <textarea>
● <button>
● <option
● <datalist>
● <optgroup>
● <button>
Form Elements
Simple Form Elements
<!DOCTYPE html>
<html>
<head>
<title>Form Elements</title>
</head>
<body>
Input Box <input type="text" name="text">
<br>
DropDown Select <select name="text">
<option>First</option>
<option>Second</option>
</select>
<br>
Text Area<textarea cols="50" rows="5">I m a text
area</textarea>
<br>
Button <button type="button"
name="button">Button</button>
</body>
</html>
Browser View
Form Elements
Simple Login Form
<!DOCTYPE html>
<html>
<head>
<title>Form Elements</title>
</head>
<body>
<form action="login.php" method="post">
Email<br> <input type="email" name="email"
placeholder="Email">
<br>
Password <br> <input type="password"
name="Password" placeholder="Password">
<br>
<button type="submit"
name="button">Login</button>
</form>
</body>
</html>
Browser View
Form Elements
Explaination
●
From line <form> - Here is form beginning form elements pass all data to new page on submitting.
Form elements pass only that data which is child element of form.
E.g <form>child Elements</form>
method= method is default get but we can use get or post.
When we use get our data pass through url which we see in url and post
pass data hidden.
action = action is our url for submitting data on that page like any server side page where it catch
that data.( which we see in php tutorial) for now we just pass and server side language catch it.
●
Other line after that are data elements which contain in its its variable and variable name is
name=”value” this value is the variable name which we catch in server side.
●
Submit = button submit is used to submit our its very important for submitting our forms.
Form Elements
Here is a list of Input Types Elements like radio,checkbox,button,date,select
select element and properties
select has a list of child elements which values we defined inside option element when we
submit the form the selected values pass through the form
<option>First</option> and <option value=”1”>First</option>
Here you two types of option i declare both is same but if we dont defined (set value=”value”)
then option text value will be passed else value attribute value pass.
● We can also make default selection of any element by using attribute
selected=”selected” in option element
● We can set the size of select box like display more than one value at a time by using.
size=”n” where n= no. Of elements to display
Form Elements
● We can also make multiple selection this time the value will pass
in array format.
By using multiple=”multiple” but for using mutiple we have to
change name in array for like my variable name is : -
name=”vegeable”
then i have to change it to
name=”vegetable[]”
if we don’t do that then we only get single selected value only
Form Elements
Select Example
<!DOCTYPE html>
<html>
<head>
<title>HTML Select</title>
</head>
<body>
<form action="http://localhost/form.php">
<select name="fruit">
<option>Apple</option><option>Mango</option><option>Orange</option>
</select><br>
<select name="animal" size="4">
<option>Cat</option><option>Dog</option><option>Elephant</option><option>Horse</option><option>Zebra</option>
</select><br>
<select name="vegetable[]" size="4" multiple="multiple">
<option>Potato</option><option>Onion</option><option>Cabbage</option><option>Pea</option><option>Carrot</option>
</select><br>
<select name="defaultselected">
<option>Potato</option><option>Onion</option><option selected="selected">Cabbage</option><option>Pea</option> <option>Carrot</option>
</select><br>
<select name="differntvalue">
<option value="1">First</option><option value="2">Second</option><option value="3">Third</option><option value="4">Fourth</option>
<option value="5">Fifth</option>
</select><br>
<button type="submit" name="submit">Submit</button>
</form>
</body>
</html>
Form Elements
Browser View PHP OUTPUT I Know You all Excited To
Check This Form Data After
Seeing Output So Jst Use
this.
Note : -Make Sure You
Install Xampp Or Local
Server .
Code :
<?php
echo "<pre>";
print_r($_REQUEST);
echo "</pre>";
Form Elements
Textarea
● Text area is a large area for writing contents like post,message it is
multi line input area.
We can change its no. Of line to occcupied by using attribute
rows=”n” n= no. Of rows
We can change its no. Of column to occupied by using attribute
cols=”n” n= no. Of cols
● E.g : <textarea rows=”5” cols=”5”>I am textarea</textarea>
Input Elements
Input Elements
● Input Elements is a huge list of types that why am covering this on last topic.
● It contain datalist like auto complete data.
● It contain checkbox,Radio button
● It also contain 3 types of buttons also button,submit,reset
button – Normal Button
submit – Form Submit Button
reset – Reset The Form Data
Input Elements
List Of Types of all Inputs (type=”value” attrribute)
● type=”text” for text input
● type=”password” for password hidden values
● type=”submit” for submit values in forms
● type=”reset” for reseting values in form inputs
● type=”radio” for radio button option
● type=”checkbox” for multi check boxes (used name in array like name=”language[]”)
● type=”color” for color picker
● type=”date” for date selecting using calendar
● type=”email” for email input
● type=”number” for number input
● type=”time” for time input
Input Elements
<!DOCTYPE html>
<html>
<head>
<title>Input Elements</title>
</head>
<body>
<form action="http://localhost/form.php" method="post">
Plain Text Box <input type="text" name="name"><br>
Password Field <input type="password" name="password"><br>
Radio Button (Gender E.g):
<label>Male <input type="radio" name="gender" value="male"><label>Female <input type="radio" name="gender" value="female"></label><br>
CheckBox (Language E.g) :
<label>C++ <input type="checkbox" name="lang[]" value="c++"></label><label>PHP <input type="checkbox" name="lang[]" value="php"></label><br>
Color <input type="color" name="color"><br>
Date (E.g DoB) <input type="date" name="dob" ><br>
Email <input type="email" name="email"><br>
Number (E.g Age) : <input type="number" name="age"><br>
Time <input type="time" name="time" ><br>
<input type="submit" name="submit" value="submit"><input type="reset" name="reset" value="Reset Form Fields">
</form>
</body>
</html>
Input Elements
Result
Input Elements
● Output using Same PHP file
Input Elements Attributes
Now We See Different Types Of Inputs Now lets see its Extra Attributes.
● value=”value” which set values in input fields.
● readonly=”readonly” which only reads values we can’t edit it.
● disabled=”disabled” disabled the input element then it will be not pass data to server.
● maxlength=”n” n= length of input field
● required=”required” used for validation without filling that field user can’t submit form.
● autofocus=”autofocus” which directly focus that field when page loads.
● placeholder=”transparent hint values” for display transparent hint values
Next Step
● I added a blog more about how to handle form data in server
side using PHP
● Check My Blog : -
http://sswebtricks.blogspot.in/2016/12/php-request-get-and-post-func
● Also Given My Link in Description.

Weitere ähnliche Inhalte

Was ist angesagt?

Web Design Course: CSS lecture 2
Web Design Course: CSS  lecture 2Web Design Course: CSS  lecture 2
Web Design Course: CSS lecture 2Gheyath M. Othman
 
A quick guide to Css and java script
A quick guide to Css and  java scriptA quick guide to Css and  java script
A quick guide to Css and java scriptAVINASH KUMAR
 
Form using html and java script validation
Form using html and java script validationForm using html and java script validation
Form using html and java script validationMaitree Patel
 
HTML Forms Tutorial
HTML Forms TutorialHTML Forms Tutorial
HTML Forms TutorialProdigyView
 
DIWE - Coding HTML for Basic Web Designing
DIWE - Coding HTML for Basic Web DesigningDIWE - Coding HTML for Basic Web Designing
DIWE - Coding HTML for Basic Web DesigningRasan Samarasinghe
 
Html basics 10 form
Html basics 10 formHtml basics 10 form
Html basics 10 formH K
 
Web Engineering - Introduction to CSS
Web Engineering - Introduction to CSSWeb Engineering - Introduction to CSS
Web Engineering - Introduction to CSSNosheen Qamar
 
Form Validation in JavaScript
Form Validation in JavaScriptForm Validation in JavaScript
Form Validation in JavaScriptRavi Bhadauria
 
New Form Element in HTML5
New Form Element in HTML5New Form Element in HTML5
New Form Element in HTML5Zahra Rezwana
 
HTML, CSS And JAVASCRIPT!
HTML, CSS And JAVASCRIPT!HTML, CSS And JAVASCRIPT!
HTML, CSS And JAVASCRIPT!Syahmi RH
 
Form Processing In Php
Form Processing In PhpForm Processing In Php
Form Processing In PhpHarit Kothari
 
Chapter 07 php forms handling
Chapter 07   php forms handlingChapter 07   php forms handling
Chapter 07 php forms handlingDhani Ahmad
 
Haml. New HTML? (RU)
Haml. New HTML? (RU)Haml. New HTML? (RU)
Haml. New HTML? (RU)Kirill Zonov
 
Php forms and validations by naveen kumar veligeti
Php forms and validations by naveen kumar veligetiPhp forms and validations by naveen kumar veligeti
Php forms and validations by naveen kumar veligetiNaveen Kumar Veligeti
 
Forms in html5
Forms in html5Forms in html5
Forms in html5hrisi87
 
Entering User Data from a Web Page HTML Forms
Entering User Data from a Web Page HTML FormsEntering User Data from a Web Page HTML Forms
Entering User Data from a Web Page HTML Formssathish sak
 

Was ist angesagt? (20)

Web Design Course: CSS lecture 2
Web Design Course: CSS  lecture 2Web Design Course: CSS  lecture 2
Web Design Course: CSS lecture 2
 
HTML5 Web Forms
HTML5 Web FormsHTML5 Web Forms
HTML5 Web Forms
 
A quick guide to Css and java script
A quick guide to Css and  java scriptA quick guide to Css and  java script
A quick guide to Css and java script
 
Form using html and java script validation
Form using html and java script validationForm using html and java script validation
Form using html and java script validation
 
html forms
html formshtml forms
html forms
 
HTML Forms Tutorial
HTML Forms TutorialHTML Forms Tutorial
HTML Forms Tutorial
 
DIWE - Coding HTML for Basic Web Designing
DIWE - Coding HTML for Basic Web DesigningDIWE - Coding HTML for Basic Web Designing
DIWE - Coding HTML for Basic Web Designing
 
Html JavaScript and CSS
Html JavaScript and CSSHtml JavaScript and CSS
Html JavaScript and CSS
 
Html basics 10 form
Html basics 10 formHtml basics 10 form
Html basics 10 form
 
Web Engineering - Introduction to CSS
Web Engineering - Introduction to CSSWeb Engineering - Introduction to CSS
Web Engineering - Introduction to CSS
 
Form Validation in JavaScript
Form Validation in JavaScriptForm Validation in JavaScript
Form Validation in JavaScript
 
New Form Element in HTML5
New Form Element in HTML5New Form Element in HTML5
New Form Element in HTML5
 
HTML, CSS And JAVASCRIPT!
HTML, CSS And JAVASCRIPT!HTML, CSS And JAVASCRIPT!
HTML, CSS And JAVASCRIPT!
 
Form Processing In Php
Form Processing In PhpForm Processing In Php
Form Processing In Php
 
Chapter 07 php forms handling
Chapter 07   php forms handlingChapter 07   php forms handling
Chapter 07 php forms handling
 
Haml. New HTML? (RU)
Haml. New HTML? (RU)Haml. New HTML? (RU)
Haml. New HTML? (RU)
 
Php forms and validations by naveen kumar veligeti
Php forms and validations by naveen kumar veligetiPhp forms and validations by naveen kumar veligeti
Php forms and validations by naveen kumar veligeti
 
HTML
HTML HTML
HTML
 
Forms in html5
Forms in html5Forms in html5
Forms in html5
 
Entering User Data from a Web Page HTML Forms
Entering User Data from a Web Page HTML FormsEntering User Data from a Web Page HTML Forms
Entering User Data from a Web Page HTML Forms
 

Ähnlich wie HTML 5 Simple Tutorial Part 4 (20)

Designing web pages html forms and input
Designing web pages html  forms and inputDesigning web pages html  forms and input
Designing web pages html forms and input
 
2. HTML forms
2. HTML forms2. HTML forms
2. HTML forms
 
HtmlForms- basic HTML forms description.
HtmlForms- basic HTML forms description.HtmlForms- basic HTML forms description.
HtmlForms- basic HTML forms description.
 
Html tables, forms and audio video
Html tables, forms and audio videoHtml tables, forms and audio video
Html tables, forms and audio video
 
Chapter 9: Forms
Chapter 9: FormsChapter 9: Forms
Chapter 9: Forms
 
20 html-forms
20 html-forms20 html-forms
20 html-forms
 
20-html-forms.ppt
20-html-forms.ppt20-html-forms.ppt
20-html-forms.ppt
 
11-html-forms.ppt
11-html-forms.ppt11-html-forms.ppt
11-html-forms.ppt
 
Html Form Controls
Html Form ControlsHtml Form Controls
Html Form Controls
 
05 html-forms
05 html-forms05 html-forms
05 html-forms
 
Lectures-web
Lectures-webLectures-web
Lectures-web
 
Web design - Working with forms in HTML
Web design - Working with forms in HTMLWeb design - Working with forms in HTML
Web design - Working with forms in HTML
 
Html class-04
Html class-04Html class-04
Html class-04
 
Html forms
Html formsHtml forms
Html forms
 
Html form tag
Html form tagHtml form tag
Html form tag
 
HTML FORMS.pptx
HTML FORMS.pptxHTML FORMS.pptx
HTML FORMS.pptx
 
Getting Information through HTML Forms
Getting Information through HTML FormsGetting Information through HTML Forms
Getting Information through HTML Forms
 
Web forms and html lecture Number 4
Web forms and html lecture Number 4Web forms and html lecture Number 4
Web forms and html lecture Number 4
 
CSS_Forms.pdf
CSS_Forms.pdfCSS_Forms.pdf
CSS_Forms.pdf
 
Html forms
Html formsHtml forms
Html forms
 

Kürzlich hochgeladen

POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppCeline George
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991RKavithamani
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 

Kürzlich hochgeladen (20)

POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website App
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 

HTML 5 Simple Tutorial Part 4

  • 1. HTML Tutorial Part 4 Welcome Again all, Today I am Going To Start New Topic Very Very Important as a Web Developer For HTML which covers Forms. Let sStart...’
  • 2. Topic ● Form Elements select and Text Area ● Input Elements ● Input Elements Attributes
  • 3. Form Elements ● Form elements are such element which we used for creating our HTML form like Some Elements input box,dropdown select,Buttons,Textarea. • Input Box – For Simple input of data in any format. • Select Dropdown – For Selecting Item in a list of items • textarea – For Large Area of Input Contents ,Description Message which is used to display our data in also multiline. • Button – For Submit our Form or Simple Button For Any Events.
  • 4. Form Elements List of Form Elements. ● <form> ● <select> ● <input> ● <textarea> ● <button> ● <option ● <datalist> ● <optgroup> ● <button>
  • 5. Form Elements Simple Form Elements <!DOCTYPE html> <html> <head> <title>Form Elements</title> </head> <body> Input Box <input type="text" name="text"> <br> DropDown Select <select name="text"> <option>First</option> <option>Second</option> </select> <br> Text Area<textarea cols="50" rows="5">I m a text area</textarea> <br> Button <button type="button" name="button">Button</button> </body> </html> Browser View
  • 6. Form Elements Simple Login Form <!DOCTYPE html> <html> <head> <title>Form Elements</title> </head> <body> <form action="login.php" method="post"> Email<br> <input type="email" name="email" placeholder="Email"> <br> Password <br> <input type="password" name="Password" placeholder="Password"> <br> <button type="submit" name="button">Login</button> </form> </body> </html> Browser View
  • 7. Form Elements Explaination ● From line <form> - Here is form beginning form elements pass all data to new page on submitting. Form elements pass only that data which is child element of form. E.g <form>child Elements</form> method= method is default get but we can use get or post. When we use get our data pass through url which we see in url and post pass data hidden. action = action is our url for submitting data on that page like any server side page where it catch that data.( which we see in php tutorial) for now we just pass and server side language catch it. ● Other line after that are data elements which contain in its its variable and variable name is name=”value” this value is the variable name which we catch in server side. ● Submit = button submit is used to submit our its very important for submitting our forms.
  • 8. Form Elements Here is a list of Input Types Elements like radio,checkbox,button,date,select select element and properties select has a list of child elements which values we defined inside option element when we submit the form the selected values pass through the form <option>First</option> and <option value=”1”>First</option> Here you two types of option i declare both is same but if we dont defined (set value=”value”) then option text value will be passed else value attribute value pass. ● We can also make default selection of any element by using attribute selected=”selected” in option element ● We can set the size of select box like display more than one value at a time by using. size=”n” where n= no. Of elements to display
  • 9. Form Elements ● We can also make multiple selection this time the value will pass in array format. By using multiple=”multiple” but for using mutiple we have to change name in array for like my variable name is : - name=”vegeable” then i have to change it to name=”vegetable[]” if we don’t do that then we only get single selected value only
  • 10. Form Elements Select Example <!DOCTYPE html> <html> <head> <title>HTML Select</title> </head> <body> <form action="http://localhost/form.php"> <select name="fruit"> <option>Apple</option><option>Mango</option><option>Orange</option> </select><br> <select name="animal" size="4"> <option>Cat</option><option>Dog</option><option>Elephant</option><option>Horse</option><option>Zebra</option> </select><br> <select name="vegetable[]" size="4" multiple="multiple"> <option>Potato</option><option>Onion</option><option>Cabbage</option><option>Pea</option><option>Carrot</option> </select><br> <select name="defaultselected"> <option>Potato</option><option>Onion</option><option selected="selected">Cabbage</option><option>Pea</option> <option>Carrot</option> </select><br> <select name="differntvalue"> <option value="1">First</option><option value="2">Second</option><option value="3">Third</option><option value="4">Fourth</option> <option value="5">Fifth</option> </select><br> <button type="submit" name="submit">Submit</button> </form> </body> </html>
  • 11. Form Elements Browser View PHP OUTPUT I Know You all Excited To Check This Form Data After Seeing Output So Jst Use this. Note : -Make Sure You Install Xampp Or Local Server . Code : <?php echo "<pre>"; print_r($_REQUEST); echo "</pre>";
  • 12. Form Elements Textarea ● Text area is a large area for writing contents like post,message it is multi line input area. We can change its no. Of line to occcupied by using attribute rows=”n” n= no. Of rows We can change its no. Of column to occupied by using attribute cols=”n” n= no. Of cols ● E.g : <textarea rows=”5” cols=”5”>I am textarea</textarea>
  • 13. Input Elements Input Elements ● Input Elements is a huge list of types that why am covering this on last topic. ● It contain datalist like auto complete data. ● It contain checkbox,Radio button ● It also contain 3 types of buttons also button,submit,reset button – Normal Button submit – Form Submit Button reset – Reset The Form Data
  • 14. Input Elements List Of Types of all Inputs (type=”value” attrribute) ● type=”text” for text input ● type=”password” for password hidden values ● type=”submit” for submit values in forms ● type=”reset” for reseting values in form inputs ● type=”radio” for radio button option ● type=”checkbox” for multi check boxes (used name in array like name=”language[]”) ● type=”color” for color picker ● type=”date” for date selecting using calendar ● type=”email” for email input ● type=”number” for number input ● type=”time” for time input
  • 15. Input Elements <!DOCTYPE html> <html> <head> <title>Input Elements</title> </head> <body> <form action="http://localhost/form.php" method="post"> Plain Text Box <input type="text" name="name"><br> Password Field <input type="password" name="password"><br> Radio Button (Gender E.g): <label>Male <input type="radio" name="gender" value="male"><label>Female <input type="radio" name="gender" value="female"></label><br> CheckBox (Language E.g) : <label>C++ <input type="checkbox" name="lang[]" value="c++"></label><label>PHP <input type="checkbox" name="lang[]" value="php"></label><br> Color <input type="color" name="color"><br> Date (E.g DoB) <input type="date" name="dob" ><br> Email <input type="email" name="email"><br> Number (E.g Age) : <input type="number" name="age"><br> Time <input type="time" name="time" ><br> <input type="submit" name="submit" value="submit"><input type="reset" name="reset" value="Reset Form Fields"> </form> </body> </html>
  • 17. Input Elements ● Output using Same PHP file
  • 18. Input Elements Attributes Now We See Different Types Of Inputs Now lets see its Extra Attributes. ● value=”value” which set values in input fields. ● readonly=”readonly” which only reads values we can’t edit it. ● disabled=”disabled” disabled the input element then it will be not pass data to server. ● maxlength=”n” n= length of input field ● required=”required” used for validation without filling that field user can’t submit form. ● autofocus=”autofocus” which directly focus that field when page loads. ● placeholder=”transparent hint values” for display transparent hint values
  • 19. Next Step ● I added a blog more about how to handle form data in server side using PHP ● Check My Blog : - http://sswebtricks.blogspot.in/2016/12/php-request-get-and-post-func ● Also Given My Link in Description.