How to use Anchor tag as submit button ?
The <a> (anchor tag) in HTML is used to create a hyperlink on the webpage. This hyperlink is used to link the webpage to other web pages. It’s either used to provide an absolute reference or a relative reference as its “href” value.
Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML course.
<a href = "link"> Link Name </a>
The href attribute specifies the URL of the page the link goes to. If the href attribute is not present, the <a> tag will not be a hyperlink. You can use href=”#top” or href=”#” to link to the top of the current page.
Note: “GFG” is the ‘id’ mentioned in the form element.
PHP code: The following code is the content for “submit.php” used in the above HTML code. We have to add some PHP code to send data to the database (use local server XAMPP to test the below code).
Now, add some data in the form. Suppose Username is ‘Akshit’ and password is ‘123’
Now click on the hyperlink “Click here to submit form“.
Let us have a look at the ‘student’ database.