All subjects · Information Technology · WIT12 3 hour practical exam on web development with HTML, CSS and JavaScript
How forms send data, and HTML form validation
Edexcel IAL Information Technology · WIT12 3 hour practical exam on web development with HTML, CSS and JavaScript
When a form is submitted, the browser checks the data and sends it to a server. You need to know how the data travels (GET and POST) and the HTML validation attributes (spec 7.3.4).
From browser to server
When the user submits a form:
1. The browser checks any HTML validation rules. If one fails, it shows a message and does not send the form.
2. It collects each control's name and value as name=value pairs.
3. It sends them to the URL in the action attribute, using the method.
4. A program on the server (for example in PHP) processes the data and sends back a response page.
For example, <form action="search.php" method="get"> sends the data to search.php using GET.
GET and POST
| method="get" | method="post" | |
|---|---|---|
| Where the data goes | Added to the URL as a query string: search.php?town=leeds&type=adult | Sent in the body of the HTTP request, not in the URL |
| Visibility | Visible in the address bar, history, bookmarks and server logs | Not visible in the URL (but still readable unless HTTPS encrypts it) |
| Size | Limited by the maximum URL length | No practical limit: suits long text and file uploads |
| Use for | Searches and filters that can be bookmarked or shared | Passwords, personal data, payments and anything that changes data on the server |
The default method is get. Examiners want the specific difference, not just 'POST is more secure'.
HTML validation attributes
<input type="text" name="fname" required minlength="2" maxlength="30">
<input type="number" name="age" min="16" max="99" step="1">
<input type="text" name="postcode" pattern="[A-Z]{2}[0-9]{1,2} [0-9][A-Z]{2}" title="For example AB12 3CD">
<input type="email" name="email" placeholder="name@example.com">- required: presence check, the field cannot be empty.
- minlength / maxlength: length check on text.
- min / max / step: range check on numbers and dates.
- type (email, url, number, date): type and format check.
- pattern: the value must match a regular expression (Topic 9); title explains the format.
- placeholder shows an example but is not validation and is not a label.
- novalidate on the form turns the browser checks off.
HTML validation improves the user experience, but users can bypass it, so servers must check the data again. JavaScript validation (Topic 9) gives custom messages and more complex rules.
Worked example
A search form uses method="get" and has one box named q. The user searches for 'tennis' and submits to results.html. What URL does the browser request?
- GET adds the data to the URL after a question mark.
- The pair is the control's name, an equals sign and its value.
Answer: results.html?q=tennis
Check yourself
- A form `<form action="find.html" method="get">` has one input named town. The user types York and submits. What URL is requested? Type it exactly.
Show answer
find.html?town=York. GET appends ?name=value to the action URL.
- Explain one difference between the GET and POST methods of sending form data.
Show answer
GET adds the data to the URL so it can be seen in the address bar, while POST sends it in the body of the request so it is not shown in the URL.. Valid differences: GET data is in the URL (visible, saved in history, bookmarkable, length-limited); POST data is in the request body (not in the URL, no practical size limit).
- Which attribute is a presence check?
- required
- placeholder
- maxlength
- pattern
Show answer
required. required stops the form being submitted with the field empty.
- Which input accepts only whole numbers from 1 to 5?
- `<input type="text" minlength="1" maxlength="5">`
- `<input type="number" placeholder="1 to 5">`
- `<input type="range" value="5">`
- `<input type="number" min="1" max="5" step="1">`
Show answer
`<input type="number" min="1" max="5" step="1">`. min and max give a range check and step="1" allows whole numbers only. maxlength counts characters, and placeholder does not validate.
- Why is placeholder not a replacement for a label?
- It stops the form submitting
- It disappears when the user types and is not reliably announced as the field's name
- It only works on number inputs
- It changes the data sent to the server
Show answer
It disappears when the user types and is not reliably announced as the field's name. Placeholder text vanishes on typing and has poor contrast, so a visible label is still needed.
- Why must data checked by HTML validation still be checked on the server?
- HTML validation only runs on the server
- Browsers delete validated data
- Servers cannot read unvalidated data
- Users can bypass browser validation, for example by turning it off or sending requests directly
Show answer
Users can bypass browser validation, for example by turning it off or sending requests directly. Client-side checks help users but can be bypassed, so the server checks again.
- Which method should a login form use?
- get, so the login page can be bookmarked
- post, so the password is not shown in the URL, history or server logs
- get, because it is faster for small amounts of data
- Either, because each method shows the data in the URL
Show answer
post, so the password is not shown in the URL, history or server logs. POST keeps the password out of the URL; HTTPS is still needed to encrypt it.
Sources
- Pearson Edexcel International Advanced Subsidiary/Advanced Level in Information Technology specification (first teaching 2018), Unit 2 Topics 7 to 11
- Pearson qualifications: Edexcel International Advanced Level Information Technology (2018)
- Pearson WIT12/01 examiner report, June 2025 series
Last updated 8 November 2026. Spotted a mistake? Tell us.