HTML forms are essential for collecting user input on websites, allowing for interactions such as search and registration. The two primary methods for submitting form data are GET, which appends data to the URL and is visible, and POST, which sends data securely in the request body. Various input types, including text, email, and password, can be utilized within forms.
Download as PPTX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
2 views
HTML Forms Presentation
HTML forms are essential for collecting user input on websites, allowing for interactions such as search and registration. The two primary methods for submitting form data are GET, which appends data to the URL and is visible, and POST, which sends data securely in the request body. Various input types, including text, email, and password, can be utilized within forms.
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 9
HTML Forms and Methods
Understanding GET and POST
Methods in Forms What is an HTML Form? • HTML forms are used to collect user input. • They allow websites to interact with users by collecting information such as names, emails, and passwords. Core Elements of an HTML Form • 1. <form>: Container for the form. • 2. Input fields: Collect data (text, email, etc.) • 3. Submit button: Sends form data to the server. Form Input Fields • <input> types include: • • text: Enter a name • • email: Enter an email address • • password: Hidden input for passwords • • submit: Button to submit the form GET vs POST Methods • GET Method: Appends data to the URL, visible. • Used for non-sensitive data (e.g., search). • POST Method: Sends data in request body, hidden. • Used for sensitive data (e.g., passwords). Form Example Using GET
• <form action="/submit" method="get">
• <label for="name">Name:</label> • <input type="text" id="name" name="name"><br><br> • <input type="submit" value="Submit"> • </form> Form Example Using POST
• <form action="/submit" method="post">
• <label for="name">Name:</label> • <input type="text" id="name" name="name"><br><br> • <input type="submit" value="Submit"> • </form> Other Form Elements • • Dropdown (<select>) • • Checkbox (<input type='checkbox'>) • • Radio buttons (<input type='radio'>) Summary • • Forms collect user input for websites. • • GET: Data in the URL. • • POST: Data sent securely. • • Use forms for tasks like search, login, and registration.