I was doing a project and one of the stake holders decided to put a mini survey on the page. I nodded the idea but I kinda feel lazy to do some coding, so I went and use my Google-fu to search for any codes or scripts that are readily available. I don’t need it to be complex so I guess there’s a lot out there. Yet, however I did not find anything as simple as I needed. And so I’m down to coding one of my own.
Here’s the idea, I wanted it to have three buttons just like this picture below, yes as simple and as plain as that.
Since my back-end is running on LAMP (Linux-Apache-MySQL-PHP) already I decided to create this survey under this setup as well. It will have an administration page like this:
Now after a few hours I come up with a survey with the following features:
- Reset the survey and records the reset as start of the new survey.
- IP address breakdown of all votes.
- Percentage tally.
- Login and out.
- MySQL DB back-end.
- will notify users if they hava already voted.
- Voting frequency can be changed depending on your needs.
How to use:
- Download the script here. File password is "123survey".
- Unzip it to your LAMP server. I assume /var/www/
- Now if you are using phpmyadmin like me, just create a new DB name it cast and have this MySQL\cast.sql.zip file imported.
- Set the group and ownership to mysql .
- Set the file permission to 700.
- Open /var/www/Connections/OpenSurveyDB.php on the line that says $password_mySurveyDB put your DB password inside the quotes.
- Then set your cron to run this script /var/www/misc.pl to run every hour. Or depending on how much interval you may want your responders to take another vote.
- Assign your DB password to this variable $pw at /var/www/misc.pl
- To respond to survey load survey.php from a browser.
- To check the results load surveylogin.php from a browser. Use "admin" as user name and "admin123" as password.
It has served it’s purpose to me so I guess I’m cool with this. Feel free to use this just drop me a line if you do so.


No comments:
Post a Comment