Given that PHP's primary role is handling web pages, you might wonder why this section has been left so late in the chapter. It is because handling HTML forms is so central to PHP that it is essentially automatic.
Consider this form:
<form method="POST" action="thispage.php">
User ID: <input type="text" name="UserID" /><br />
Password: <input type="password" name="Password" /><br />
When a visitor clicks Submit, thispage.php is called again and this time PHP has the variables available to it inside the $_request array. Given that script, if the user enters 12345 and frosties as her user ID and password, PHP provides you with $_REQUEsT['useriD'] set to 12345 and $_REQUEsT['Password'] set to frosties. Note that it is important that you use HTTP post unless you specifically want get. post enables you to send a great deal more data and stops people from tampering with your URL to try to find holes in your script.
Was this article helpful?