All TalkersCode Topics

Follow TalkersCode On Social Media

devloprr.com - A Social Media Network for developers Join Now ➔

How To Pass Parameters In Form Action In HTML

Last Updated : Mar 11, 2024

How To Pass Parameters In Form Action In HTML

In this tutorial we will show you the solution of how to pass parameters in form action in HTML, first here as this article belongs to php, so user must have basic knowledge of php language and php tags, etc.

Today, our topic is how to pass parameters in form action in html.

Here, we want to describe you that how you are able to pass the parameters from one page to another or same page with values assigned to parameters. Let us understand how this can be done.

Step By Step Guide On How To Pass Parameters In Form Action In HTML :-

Now, here we will provide you the html code, in which we create a form.

Whereas php is also used in this, you have to first connect it to server and have to create table, means your database must be prepared.

In some next steps we help you to understand what is going to done in this code.

<!Doctype html>
<html>
    <head>
        <title>
            display data from database
        </title>
    </head>
    <body>
       <form method="get" action="demo.php?id=1">
        <p><input type="text" name="name" placeholder="Enter name" /></p>
        <p><input type="password" name="password" placeholder="Enter password" /></p>
        <input type="submit" name="data_send" value="Submit " />
</form>
    </body>
</html>
  1. First, we write <! DOCTYPE html> which we used as an instruction to the web browser about what version of HTML file is written in.
  2. Secondly, the <html> tag is used to indicate the beginning of an HTML document.
  3. As above now <head> tag is used to contain information about web page.
  4. In this tag a <title> tag is used which helps us to specify a webpage title. Both <head> and <title> tags are Paired tags. So, both have </head> and </title> ending tags respectively.
  5. Here we create a body tag, which is a paired tag. All the data which we want to show on webpage is written here. And in this case we create a form tag.
  6. And the method used is get, you can also use post. Now, after this we create input tags with label tags. The label tags are used to show you text on the web screen.
  7. Whereas the input tag is used to make a field for input. And here it is mandatory to give name to input tag.
  8. In form action, you have to give the link of webpage where you want user to redirect when submit button gets clicked.
  9. Here we use ? after action this is because to make a concatenation link between html page and database.
  10. Here, you have to specify the name of columns of table. In which you want to enter the values that we feed in input tag. And also known as parameter.
  11. At last, the <body> and <html> tags are closed with </body> and </html> respectively.

Conclusion :-

In conclusion, here we can say that you have to link the parameters with the help of action of form and through the input tag.

Rest work is done with the help of database and concatenate database with html. I hope this tutorial on how to pass parameters in form action in HTML helps you.

Author Image About Pragati

Experienced coding content writer who enjoys breaking down complex concepts in programming languages like Java, Python, C, and C++. Over three years of experience producing interesting and relevant content for a variety of entities. Committed to providing concise and easy-to-understand articles that assist readers in easily understanding technology and industry trends in the world of coding and software development.

Follow Pragati On Linkedin 🡪