HTML and CSS Reference
The fact that you have used a relative path here means that the bookings.php file must be in the same folder as
the bookings.html file.
Don't worry that you don't actually have a bookings.php in your project folder. We are just going to pretend that
it's there and that it will create a new booking when the form is submitted.
To be able to process the data, you would need to write a program using a programming language such as PHP,
Ruby or Python, which is beyond the scope of this topic. If you are interested in learning more about server-side
programming, check out this Treehouse course by Jim Hoskins and Jason Seifer ht-
The method Attribute
The method attribute is used to specify how you want the form data to be sent to the server. There are two ways of
sending form data, GET requests and POST requests. If you forget to specify a method attribute on your form, the
GET method is used by default.
The GET Method
The GET method sends your form data within a URL. This method is commonly used when performing tasks that
just need to fetch existing data from a web server, such as searches or product filters on e-commerce websites. When
a user submits the form, the browser will start to create a new URL to send the user to. This will look something like
the URL below.
This URL has a number of different parts. Let's look at them in more detail.
The Domain Name
The first part of the generated URL is made up of the protocol (http://) and the fully qualified domain name
( www.html5foundations.com ).
If you are using an absolute URL, you would have explicitly defined this domain name in your action attribute.
Should you be using a relative URL in your action attribute, the browser will automatically take the domain name
from the page the form is submitted from. For example, if your form is on the www.html5foundations.com/
bookings.html page, the browser will use www.html5foundations.com as the domain name.
The path segment of the URL represents the path to the file that will process the form data. I have highlighted the
path segment of our example URL in bold.
http://www.html5foundations.com /bookings.php ?name=Joe%20Balochio
The URL Parameters