View Full Version : Creating a poll...any experts out there?

05-04-2011, 06:24 AM
Hi all!
Newbie here, I've just started doing a little bit of freelance web design work to help make some extra money and pay the bills. I'm doing pretty basic stuff for friends and friends of the family. I haven't really done serious web design stuff since high school (2001-05), when I first taught myself HTML. I learned some CSS in college, but now as I design, I mostly use Komopozer (WYSIWYG) to help me lay out the site and use my own (albeit, outdated) knowledge to clean up things or fiddle with details in the source code.

If any of you are experts on setting up a poll for a website I could really use your help!

I'm working on a website for a friend. It's pretty simple, except he wants me to include a poll in it and that's what's giving me the most trouble. I've tried googling how to create a poll but all I keep getting is poll creating websites, most asking for money and simply offering to host a poll or survey on their site. What I want to do is create a poll within the website itself. Here are the elements it should include:

The poll is asking people to vote for a candidate, there are 4 options.

1. Three candidates are pre-selected. For these options, I need to set it up so that you can just click on an image that says "Vote for Bill" (or whatever) to cast the vote

2. The 4th is an "other" option, where people can either choose from a drop down list of options, or in a form box type in their "write in candidate", and then click on the "Vote for Other" image to cast their vote

3. Once you vote, you should be automatically directed to a live results page that has a number or percentage break down of all the votes that have been cast so far (Candidate A, Candidate B, Candidate C, Other)

4. It would be nice if a report or email could be generated on the back-end so that my friend can see what someone has voted for, especially if they picked someone from the drop-down or wrote someone in the form box (he's curious to see what people are choosing or writing in)

5. The final, and perhaps separate element, would be placed underneath the results graph. It would be a form (all fields mandatory) where people could enter their name, email, etc. to be informed of updates, changes etc. It's basically just an email capture opportunity, but if it's possible I think my friend would like a way to link the information a person enters there with whatever vote they just made.

6. This last part might be me getting too ambitious, but of course we want a social media element to it. I could go the simple route and just do a simple "share on facebook" button, that just shares the website. However, it might be kind of cool to set it up so that when someone votes it shares on facebook as: "I voted for Candidate A! Who would you vote for? Visit website.com and cast your vote" or whatever.

So does anyone have suggestions for how it would be possible to set up a poll like this? Is it possible to just code it right in to the website? Right now the page is just plain HTML and some CSS. Will I need to use PHP or other fancy web languages that I'm not yet familiar with? :)

Any help, advice, links to tutorials, etc would be much appreciated. Thank you!

05-04-2011, 06:34 AM
The bottom line here is that you will need to store the votes for the poll options in some sort of database like MySQL or at the very least a text file. Either way, you will need server side scripting like PHP, ASP etc etc to update/edit the vote data in the database or text file.

You can then use PHP's GD library functions to draw graphs of the poll results in a web page.

So everything you need to do can be done, but it is not a small application you are describing.

05-04-2011, 06:51 AM
Thanks bullant, as I finished typing out that super long post I suspected that I was in way over my head. He wants/needs the site done in the next few days, but I don't see that happening. I don't think I can learn what I need to get it done fast enough, plus as I browse the forum it looks like my web design techniques are even rustier than I thought (I still use tables to help me lay out the design of a site, which apparently is NOT a good idea anymore...)

Anyway, the only thing I can think of now is perhaps doing this whole thing on google docs and tell him to redirect his URL. The whole point of his site is the poll anyway. Kind of sad though, because I spent quite a few hours yesterday putting together the site (now proving to be useless) that I have now :(

05-04-2011, 06:59 AM
no problem :)

and hopefully the work you have done so far is not a waste because hopefully it will have helped refresh your knowledge and maybe pick up a few new concepts.

But I would recommend establishing a reasonably good understanding of (x)html/css/javascript before delving too much into server side scripting and database driven websites.