View Full Version : making a voting poll on my page

05-26-2004, 12:21 PM
hi all, can anyone point me 2 a tutorial on how to make a little voting thing on my page, ive looked 4 some premade ones but they dont really work for me. i need it WITHUT a database, please help

05-26-2004, 10:38 PM
How do you want them to vote then? Saving the data to a textfile? Or do you want votes to be sent to your email box, and then you can update the stats as you like?

Is it just a voting page or a poll where voters can see the current-up-to-date stats of the poll? If it's just voting, you can have them send it to your email for viewing, or save it to a textfile.

If you don't want a database (like MySQL) but don't mind a textfile, you should checkout textDB:

It's made by a member of CF. I haven't used it, but it looks like it should be cool.

If you want stats, but don't want a database or a textfile, how do you plan on storing people's votes in order to derive stats?

If nothing else, hopefully this post gets you thinking in the right direction. Either way, we need more information about what sort of poll you're trying to develop other than it can't use a database.

Hope that helps,

05-28-2004, 01:02 AM
You can use a textfile really easily, the problem would be making it graphical.

$poll = file("poll.txt"); // this does not record, just reads the current votes
$option1 = strlen($poll[0]);
echo ("Option one: $option1 vote(s)<br>\n");
$option2 = strlen($poll[1]);
echo ("Option two: $option2 vote(s)<br>\n");
$option3 = strlen($poll[2]);
echo ("Option one: $option3 vote(s)<br>\n");

That just records, in order to put votes in, just expand the line that the option is on one character, I assume you can do that, if not I can write that for you...