PHP Online Survey System

Source: Internet
Author: User
Tags php and php code php online
PHP Online Survey System
This is a simple voting procedure, for just learning PHP and friends is a very good starter program. Here to introduce you, hope to be able to help friends.
The system is composed of the following four files: The survey.htm of the HTML survey form, the survey.php to realize the investigation function, Record the data.txt of the investigation project and record the survey.txt of the investigation results. Data.txt and Survey.txt We can create them in Notepad and upload them to the program directory. The file data.txt contains items to be investigated, note that each project should occupy one line, and survey.txt can be an empty file with nothing.
The survey.htm code can be as follows:
<title>survey</title>
<body>
<form method= "POST" action= "survey.php" >
<p><input type= "Radio" value= "0" name= "vote" > Investigation Project </p>
<p><input type= "Radio" name= "Vote" value= "1" > Survey Item two </p>
<p><input type= "Radio" name= "Vote" value= "2" > Survey Item three </p>
<p><input type= "Radio" name= "Vote" value= "3" > Survey Item four </p>
<p><input type= "Radio" name= "Vote" value= "4" > Survey Item five </p>
<p><input type= "hidden" name= "Go" value= "1" >
<p><input type= "Submit" value= "submitted" name= "B1" ></p>
<a href= "Survey.php?result=1" > View results </a>
</form>
</body>
Note that the survey items in the file data.txt must be consistent with the number and arrangement of the above survey items, or they may be wrong or the results of the investigation will not be accurate. In order to display the survey results in a bar chart, you should prepare a number of different color bar pictures. such as: 0.gif,1.gif,2.gif,3.gif,4.gif and so on.
The following is the survey.php code to implement the survey function:
?
$data = "Data.txt";
$votes = "Survey.txt";
$dataf =file ($data); /* Read the items in the survey project document * *

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.