
HTML Forms are the main form of user interaction on the web. They are used for collecting user input and sending it to a server for further processing. The HTML Forms come in various sizes that are utilized, from simple search bars to multi-page questionnaires. We can customize our HTML forms using various components and styling. Let us know more about HTML forms in this article.
| <form action="/submit-form" method="post"> <!-- Form elements go here --> </form> |
| <input type="text" name="username" placeholder="Enter your username"> <input type="password" name="password" placeholder="Enter your password"> <input type="email" name="email" placeholder="Enter your email"> <input type="submit" value="Submit"> |
| <textarea name="message" placeholder="Enter your message"></textarea> |
| <select name="options"> <option value="option1">Option 1</option> <option value="option2">Option 2</option> <option value="option3">Option 3</option> </select> |
| <button type="submit">Submit</button> |
| <label for="username"> Username: </label> <input type="text" id="username" name="username"> |
| <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Feedback Form</title> </head> <body> <h2>Feedback</h2> <form action="/submit-feedback" method="post"> <label for="name"> Name:</label> <input type="text" id="name" name="name"> <label for="email">Email:</label> <input type="email" id="email" name="email"> <label for="rating">Rating:</label> <select id="rating" name="rating"> <option value="1">1 - Poor</option> <option value="2">2 - Fair</option> <option value="3">3 - Good</option> <option value="4">4 - Very Good</option> <option value="5">5 - Excellent</option> </select> <label for="comments">Comments:</label> <textarea id="comments" name="comments"></textarea> <button type="submit">Submit Feedback</button> </form> </body> </html> |
| <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Login Form</title> </head> <body> <h2>Login</h2> <form action="/login" method="post"> <label for="username">Username:</label> <input type="text" id="username" name="username" required> <label for="password">Password:</label> <input type="password" id="password" name="password" required> <button type="submit">Login</button> </form> </body> </html> |