Pre-study Preparation:
PHP4.03 installation under Linux
Installation of PHP4.04 under Win98
Installation of PHP4.04 under English Win2000
If you cannot find the installer, please download it below:
Php4.04beta WIN32 installation program
PHP4.03 source Program
PHP3.0.16 WIN32 installation program
PHP3.0.16 source Program
Ok! now should have nothing to stop us from learning, let ' s go!
Before we begin our study, let's start by talking about the basics of forms, and if you're familiar with HTML, you can skip that section and learn directly.
Therefore, the name incredible form is the use of Web pages to collect data tools, such as you want to do a mass survey on the internet ah what, it must be indispensable to use his. Let me briefly introduce the basics of the form, and consult the HTML manual for details about him.
The use of forms is actually very simple, so let's take a look at the following examples:
< FORM action= "< php echo $php_self?>" method=post>
Name: < INPUT type=text name= "Name" >
Single selection:
< INPUT Type=radio Name= "A" value= "I'm stupid" > I'm stupid.
< INPUT Type=radio Name= "A" value= "I am very stupid" > I am very stupid
< INPUT type=radio name= "First" value= "I'm just a dork" > I'm just a dork.
Multiple choices:
< INPUT type=checkbox name= "second[]" value= "I like playing basketball" > I like playing basketball.
< INPUT type=checkbox name= "second[]" value= "I like swimming" > I like swimming
< INPUT type=checkbox name= "second[" value= "I like dancing" > I like dancing.
< INPUT type=checkbox name= "second[]" value= "I like climbing" > I like hiking.
< INPUT Type=hidden name= "stage" value= "Results" >
< INPUT type=submit value= "Thank you" >
</form>
Name:
Single choice: I'm stupid, I'm stupid, I'm a dork.
Multiple options: I like playing basketball I like swimming I like to dance I like to climb mountains
What do you think? Do you understand me? The previous section is the HTML source code for the form, and the next section is the form's representation in the browser. Logo < form action= "< php echo $php_self?>" method=post> indicates that a form is started and the form ends when the flag </form>. The program that handles this form is indicated by the action attribute in the form flag. Here for <? Echo $php_self, where $php_self is a global variable in PHP that holds the file name,< that currently executes the PHP program page? echo $php_self?> means to use the current PHP program to process the form. So what does the following method=post mean? In fact, there are two ways to send a form to a server from a browser. Get and POST. The Get method packages the data to the server as part of the URL as a whole in the environment variable query_string. Post does a lot of things like get, and the difference is that it sends data to the script in a separate way. Your script gets this data through standard input. The QUERY_STRING environment variable will no longer be set. So post has better security, especially if you have a lot of data in your form. When you use GET, the server assigns variable query_string to all form data, but the variable can be stored in a limited amount. In other words, if you have a lot of data but you use GET, you lose a lot of data. If you use post, you can use as much data as possible, because the data is never assigned to a variable. There is also the benefit of using post to pass data, which does not expose the data you send to the browser's address bar like get, like this: form.php?name=genius&pwd=123456, you see? So it's a little more reassuring to post.