Contact Our Development Team
Free Code Tutorials & Open Source Code
Submitting Forms
Tutorials > HTML > Forms > Submitting Forms
Submitting Forms
Now you know how to construct your form, how do you get it to the script processing it? This is done through the method="" and action="" attributes of the form. The methods you can use are:
  • GET - Sends the data through the 'get' method (which is in the URL). This is useful for pages which a user may want to bookmark and simple forms, but should not be used for any data which you may want to keep hidden.
  • POST - Sends the form data as post data which is hidden. You can't bookmark pages based on POST data, but you should use this whenever you have large amounts of data or private data being transferred.
The action parameter should just be the URL of a script you want to send the data to, for example action="login.php". Here's an example login form (with a button instead of submit, because the form points at a script that doesn't exist!).
<form name="login" method="POST" action="login.php">
    <input type="text" name="username" value="Username" size="20" /> <br />
    <input type="password" name="password" value="" size="20" /> <br />
    <input type="button" value="Log In">
</form>
Username:
Password:
In our PHP tutorials, we'll look at how this data is received by the script and how to process it
Page Responses
Currently there have been no responses to this page...
If you have anything to contribute to this tutorial, found a bug, or know a better way of achieving the same goal, please leave your response below.
     
Copyright ©2009, Wired IDS Ltd. | Licensed under Creative Commons Attribution Share-Alike | Load time: 0.2967 seconds