Changes

PHP and HTML Forms

780 bytes added, 18:41, 5 June 2007
no edit summary
In this chapter will create a simple HTML form to gather information from the user and then create a PHP script to process that data once it has been submitted to the server. This chapter assumes an understanding of HTML forms. See the [[An Overview of HTML Forms]] chapter for a basic overview of this topic.
 
== Creating the Form ==
 
The first step involves creation on an HTML page to contain our form. The form will be very simple in that it will contain only a text area for the user to enter data and a submit button with which to send it to the server. We will use the POST method of transmitting the data to the server and specify "subscribe.php" as the server side script to hanlde the data:
 
<pre>
<html>
<head>
<title>Simple HTML Form</title>
</head>
<body>
<form action="submit.php" method="post">
 
<input type="text" name="customerName" value="Enter your name here" />
<input type="submit" name="submit_button" value="Press to Submit" />
 
</form>
</body>
</html>
</pre>
 
The above HTML code will result in the following when loaded into a web browser:
 
[[Image:foo.jpg]]