Okay, guys.
So what do you think should be our next step?
I think that we should go with forms because it is a prerequisite for everything else.
Without forms, it's hard to talk about security as security is mostly around user input.
It's hard to handle form submission without the form and impossible to store any data and display it
if there was no user input first.
That's why we are going to create a page that displays a form.
Before we do though, there is a tiny adjustment with the router that I'd like us to make right away.
And this is to exit at this point to just to just stop the execution.
Because here we already returned the text and the error code that the page wasn't found.
So we don't want any further rendering after that.
And another thing that I just wanted you to be aware of that currently, the URL query parameters that
you might remember we've used in another project for product filtering.
They don't work with our current router, but we will also be fixing this later.
So let's focus on creating the page with the form.
So let's begin by adding the new route that will display the form.
So inside the routes folder let's create a new one I'm gonna call it contact.
So that's contact.
The method is get like the default HTTP method when browser loads a page.
And here I'm just going to add a PHP tag.
And I'm gonna render a view passing the name of the template that is exactly the same as the route name.
Now in the future we might even remove the need for a route handler for such simple pages and just display
the template that is for later Vo.
And now let me add a contact.
Get php file inside templates.
Okay, now we are ready to develop the template.
One more thing though.
Let's jump to a header and add a menu item.
Let it be contact form and this should lead to a contact page.
Okay, it seems that it works because it's empty page, but at least we don't have 404.
Now jump back to the template.
So let's add a section element and inside it are subheader.
What can it be?
Maybe leave a public note or question.
So next up we need to add the form element.
So the action, well, we are going to skip the action because the default behavior is to send to the
current URL.
So this is what we want.
We only want the method to be specified.
And I like it to be post like that.
Now here in the future, the first thing that will be in this form will be an input of type hidden that
will contain the CSRF token.
I'm going to talk about this later.
You might have seen that on the diagram.
This is for securing the form but that's for later.
Now let me start with a label saying name.
And right after I'd like the input of type text.
The name of it well is name.
Let's copy paste that because another thing we want is an email.
There is also an email type on the inputs.
Almost done.
The final label is the actual message.
This time we would want the text area.
Let's give four rows for the people to write longer messages.
And the name of this field is message.
Let's see how does it look like so far?
Okay that's decent.
And now we need a button that will submit this.
Let's add a label send message.
And just for clarity I'm adding the type submit.
That's the default type anyway.
Okay.
This should look fine.
Now if I submit this we see 404 not found.
But that's expected.
We haven't created a route handler for the post method.
And this is how we send the form.
So we're going to be working on that in the next video.