voting with php
Moderator: General Moderators
voting with php
hi everyone, yes im new to the forum!! is there anyone that can help me with some php code. i have to make a wepage using html and php which does the following
1. present visitors to the website with a multiple-choice question, which allows them to select just one of the answers (i.e, the choice they want to vote for)
2. allow voters to see how others have voted (in terms of percentages voting for each choice), but only after they themselves have voted
The website should not allow visitors to vote more than once (this is done by setting a cookie).
Having the code as a separate html and php file is prefered.
Please help me!!!!!
1. present visitors to the website with a multiple-choice question, which allows them to select just one of the answers (i.e, the choice they want to vote for)
2. allow voters to see how others have voted (in terms of percentages voting for each choice), but only after they themselves have voted
The website should not allow visitors to vote more than once (this is done by setting a cookie).
Having the code as a separate html and php file is prefered.
Please help me!!!!!
This can just be a basic HTML form, but in the line:1. present visitors to the website with a multiple-choice question, which allows them to select just one of the answers (i.e, the choice they want to vote for)
Code: Select all
<form action="vote.php" method="post" enctype="multipart/form-data">Then on vote.php you can use the variables passed from the form (more info). You can either enter these results into a database (like MySQL) or just into a text file (tutorial).
You will also need to know how to use cookies.
aquila125, its a full script request!!! i spent so much time workin on my macromedia flash mx and now ive only got a small amount of time to do this. If your a pro then this will be minoir for you but im new to this program so i got quite abit to learn. I've also got my c++ program to work on aswell!!! so theres alot of work and i was jus wondering if sum1 can be kind and generous enough to work ths one out for me.
why not do a search on http://www.hotscripts.com
click here for the search i did http://www.hotscripts.com/cgi-bin/searc ... ng&catid=2
you will definately find some FREE scripts on there
Mark
click here for the search i did http://www.hotscripts.com/cgi-bin/searc ... ng&catid=2
you will definately find some FREE scripts on there
Mark
Try this: http://www.hotscripts.com/Detailed/6752.html
It's a simple poll with text files used for data handling. You can always edit it if you want. Should take out a large amount of coding time because you're starting with a base.
It's a simple poll with text files used for data handling. You can always edit it if you want. Should take out a large amount of coding time because you're starting with a base.
So many files!?7up wrote:DuFF, thnx for that but wy are there so many files!!! your a programmer cant u make i lil program for me??
there like 2 php files and a text file + a couple of images. Open the file called README with wordpad, there is full instructions on how to set the script up. It won't take even a novice more than 5-10 mins to be up and running.
Heres the instructions:
4. Installation and Configuration:
==================================
It's a PHP script, so installation is pretty easy.
Copy '*.php', 'poll_data.txt' and 'vote/*' in your good directory.
Change permissions to 'poll_data.txt' for be writing by nobody (chmod a+rw)
Edit 'php_poll.php', you will have to do some configuration:
$RESULT_FILE_NAME = "poll_data.txt";
// En: Absolute path and name to file contain poll data.
$QUESTION = "How do you like this Script?";
// En: Question Text.
$ANSWER = array("Love it!", "Like it!", "Its okay..", "I dislike it", "I hate it..");
// En: All answer.
$IMG_DIR_URL = "./vote";
// En: URL Directory of poll graphs.
$REVOTE_TIME = 3600;
// En: Time (second) after people can revote, use cookies.
You can edit 'test.php' to change look.
5. How to run it ?
==================
go on http://www.hostname.dom/dir/test.php