HTML me <form> tag ek markup tag hai jiske dwara HTML form create kiya ja sakta hai. <form> tag ka use data ko collect karne ke liye kiya jata hai, jaise ki user input ya user choices.<form> tag me various input fields jaise ki text boxes, radio buttons, checkboxes, dropdown lists, submit buttons, etc. include kiye ja sakte hain. Iske sath hi form ka action attribute define kiya ja sakta hai jisme form ke data ko send karne ke liye web server ka URL specify kiya jata hai.
Kuch common attributes <form> tag ke hote hain:action: Ye attribute form data ko send karne ke liye server ka URL specify karta hai.
method: Ye attribute form data ko send karne ke liye HTTP method (GET or POST) specify karta hai.
target: Ye attribute form data ko kaha pe submit karna hai woh specify karta hai (jaise ki current window, new window, etc.).
Example:
<form action="process-form.php" method="POST">
<label for="name">Name:</label>
<input type="text" id="name" name="name"><br>
<label for="email">Email:</label>
<input type="email" id="email" name="email"><br>
<label for="message">Message:</label>
<textarea id="message" name="message"></textarea><br>
<input type="submit" value="Submit">
</form>
Is example me, <form> tag ka use ek basic contact form create karne ke liye kiya gaya hai. Iske attributes me form ke data ko process karne ke liye "process-form.php" page ka URL action attribute me specify kiya gaya hai aur form data ko submit karne ke liye "POST" method ka use kiya gaya hai. Iske sath hi form me name, email, aur message input fields include kiye gaye hain aur submit button bhi shamil kiya gaya hai.
Form Tag me sabse bada attributes hai "Type" ye attribute different types ke input fields (jaise text, password, email, number, date, time, radio buttons, checkboxes, select boxes, submit buttons, etc.) aur links ke liye use hota hai. type attribute aksar form elements ke saath use kiya jata hai. Ye input field text input field hai jiska use user apna naam enter karne ke liye kar sakta hai.
Type attribute values example:
Text Input:
<input type="text" name="username" placeholder="Enter your username" />
Password Input:
<input type="password" name="password" placeholder="Enter your password" />
Email Input:
<input type="email" name="email" placeholder="Enter your email" />
Number Input:
<input type="number" name="age" min="18" max="100" step="1" placeholder="Enter your age" />
Date Input:
<input type="date" name="dob" />
Time Input:
<input type="time" name="appointment_time" />
Radio Buttons:
<label for="male">Male</label>
<input type="radio" id="male" name="gender" value="male">
<label for="female">Female</label>
<input type="radio" id="female" name="gender" value="female">
Checkboxes:
<label for="option1">Option 1</label>
<input type="checkbox" id="option1" name="option1" value="option1">
<label for="option2">Option 2</label>
<input type="checkbox" id="option2" name="option2" value="option2">
Select Box:
<select name="country">
<option value="India">India</option>
<option value="USA">USA</option>
<option value="UK">UK</option>
</select>
Submit Button:
<input type="submit" value="Submit" />
umeed hai apko sare tags ache se samaj me aay hoge
next lecture k liye humri blog ko follow karte rahe aur agar apko humara blog
pasand aaya to apne dosto se bhi share kare. milte hai next lecture k liye tab
tak k liye allahafiz
"HTML Unleashed: A Comprehensive Guide"
"Mastering HTML: From Basics to Beyond"
"HTML Essentials: Building the Web"
"HTML Demystified: Tag by Tag"
"The HTML Playground: Your Coding Hub"
"Unlocking the Web: HTML Explained"
"HTML Wizardry: Crafting Web Pages"
"HTML Insights: A Developer's Handbook"
"HTML Made Simple: Learn and Create"
"HTML Chronicles: Your Journey Begins Here"
"FOR MY CHANNEL" ❤️LIKE 💬COMMENT 🔗SHARE ❗🔥🔥🔥🔥SUBSCRIBE NOW 🔔PRESS THE BELL ICON FOR
NOTIFICATION
Comments