Forms are a major external form of implementing dynamic Web pages that use forms to collect information submitted by clients. Forms are an important part of website interaction.
This section will provide a comprehensive example that will combine the various components of the form described in the previous chapter examples to achieve a comprehensive application of all components together. Based on the previous section, "Insert a form in a normal Web page", use PHP code to get the value of the form element. The value of each component is submitted to this page through the POST () method, and the value of the commit is obtained by $_post.
The specific steps are as follows:
(1) The HTML page of the form is designed as follows, directly on the code:
<! DOCTYPE html><?php if ($_post[' Submit ']!= ") { //To determine if the form was submitted with echo" Your resume is: ". <br> '; echo "Name:". $_post[' user ']. ' <br> '; Output User name echo "Gender:". $_post[' sex ']. ' <br> '; Output gender echo "Password:". $_post[' pwd ']. ' <br> '; Output password echo "Education:". $_post[' select ']. ' <br> '; Output education echo "hobby:"; for ($i =0; $i <count ($_post["fond"]), $i + +) { //The value of the check box for the Hobby echo $_post["fond"] [$i]. ' '; } echo "<br>"; $path = './upfiles/'. $_files[' image ' [' name ']; Specify the path and file name of the upload //move_uploaded_file ($_files[' image ' [' img_name '], $path); Upload file echo "Photo:". " $path ". ' <br> '; Output the path of a personal photo echo "Profile:". $_post[' intro '; Export the content of your profile}?>
Description: Please refer to topic.alibabacloud.comphp $_files for uploading files or images.
(3) Create a Upfiles folder in the root directory of the above example to store the uploaded files.
(4) Enter the running address in the browser and press ENTER to get the result as shown:
Summary: The above is the combination of PHP and WBE forms of application, friends need more practice, master These technical points, you can apply more freely to the form, meaning already have the ability to develop dynamic pages, for the next step in-depth study of PHP language to lay a good foundation.