Topic : HTML FORM Action Attribute
Part - 2
If you noticed, in the previous part of this tutorial, within <form> tag we used Action or Method attributes. Let's understand these attributes separately :
<form action="dislay.php" method="">
In the above code, I leave the method attribute blank. we will discuss this into next part of this tutorial.
The action attribute is very important when you will make a website. The attribute action tells that " where do you want the form sent?". If you will not mention the action attribute in your form then your form information will not get anywhere and you will lost the information.
As this tutorial is based on PHP, so there are several ways to send the form to another page such as PHP Script, an email-address, a CGI Script, or any other form of script.
If you want to send the script to the same page that the form is on. In other words, if you want send it the form to itself in PHP, there is a popular technique that you'll see both in action.
<form action="basic_form.php" method="">
So, here we are going to send the form data on the same page as the one we have loaded ? to itself. Save your work again and then click it to submit button and it will retrieve to the same page. You cannot see any change on the page but also you will not see any error on the page. Once you added the action attribute in your script then you submit your form easily.
To handle the form data efficiently, we can add some PHP script also that we will discuss later part of this tutorial.
In the next part, we will discuss about the Method attributes :
Recommend the tutorial