Computer >> Computer tutorials >  >> Programming >> HTML

How to link a submit button to another webpage using HTML?


Submit button automatically submits a form on click. Using HTML forms, you can easily take user input. The <form> tag is used to get user input, by adding the form elements. Different types of form elements include text input, radio button input, submit button, etc.

To link a submit button to another webpage, use the form action attribute. Add the link in the attribute, for example − <form action=”/new.php”>

How to link a submit button to another webpage using HTML?

Example

You can try to run the following code to link a submit button to another webpage −

<!DOCTYPE html>
<html>
   <body>
      <form action="/new.php">
         Student Name:<br> <input type="text" name="sname">
         <br>
         Student Subject:<br> <input type="text" name="ssubject">
         <br>
         <input type="submit" value="Submit">
      </form>
   </body>
</html>