Page 1 of 2

voting with php

Posted: Tue Dec 09, 2003 12:47 pm
by 7up
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!!!!!

Posted: Tue Dec 09, 2003 3:23 pm
by xisle
Sounds good, when do you get started?

Posted: Tue Dec 09, 2003 3:38 pm
by DuFF
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)
This can just be a basic HTML form, but in the line:

Code: Select all

<form action="vote.php" method="post"  enctype="multipart/form-data">
set the action="vote.php" to whatever PHP file you want the results to show up on.

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.

Posted: Tue Dec 09, 2003 4:12 pm
by 7up
xisle, yeh its sound gud but a bitch to do!! gettin started on it now!

DuFF, cheerz, i'll check them notes out! if i hav any problems i'll msg u 2 help me out as ur the only one that's given sum useful info!

Posted: Wed Dec 10, 2003 6:19 am
by 7up
hello anyone else that can help me??

Posted: Wed Dec 10, 2003 7:54 am
by aquila125
what's the exact problem?

Is it a full script request? Is there a problem with your code? ...?

Posted: Wed Dec 10, 2003 9:51 am
by 7up
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.

Posted: Wed Dec 10, 2003 9:52 am
by JayBird
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

Posted: Wed Dec 10, 2003 10:38 am
by 7up
Bech100, thanks for that, the thing thats far too complex from what i need. i only want to operate using html and php and a data(txt) files. No need for MySQL or apache any other database. if you know how to do it then jus do the code im sure its not that long.

cheerz

7up ghetto

Posted: Wed Dec 10, 2003 10:41 am
by 7up
and for the downloads which are useful on that webpage is says this..."Diese Präsenz ist leider nicht verfügbar." whatever that means!! doesnt let me download it

Posted: Wed Dec 10, 2003 3:40 pm
by DuFF
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.

Posted: Thu Dec 11, 2003 3:07 am
by 7up
DuFF, thnx for that but wy are there so many files!!! your a programmer cant u make i lil program for me??

Posted: Thu Dec 11, 2003 3:54 am
by JayBird
7up wrote:No need for MySQL or apache any other database...
Just a quick note, apache isn't a database ;)

Mark

Posted: Thu Dec 11, 2003 3:58 am
by JayBird
7up wrote:DuFF, thnx for that but wy are there so many files!!! your a programmer cant u make i lil program for me??
So many files!?

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

Posted: Thu Dec 11, 2003 5:00 am
by 7up
which poll is that from the list???? i'll giv that a try