Jump to content

How do you make a poll?


knimbus

Recommended Posts

How can you make a poll in html or javascript that has X number of options which the user selects as a radio buttons and then a submit button which will increase the overall score for both of them, kinda like this:key: X = radio buttonFavourite colour:X greenX red submitand then the page reloads like this:green = 80% and 8 votesred = 20% and 2 votesany help is appreciated

Link to comment
Share on other sites

That would require the scores to be remembered in some way, maybe as simple as a txt file, so you would be looking at a server side language not client side.

Link to comment
Share on other sites

out of the server side scripting, i know php the best, but i dont know it well by any means, could you plse give me the code

What :) I don't have this code just lying around you know.Learn how PHP Forms work: http://www.w3schools.com/php/php_forms.aspThen you would probably want to read the current values from the text file, add the current choice to that value then send that back to text file.If you search google for "Working With Text Files in PHP"http://www.htmlgoodies.com/beyond/php/article.php/3472531
Link to comment
Share on other sites

you could just add something like yes or no to a text file, and then when you need to see how many people have voted what, you just use the substr_count($file, 'yes'); LG

Link to comment
Share on other sites

Are you saying just create a form like that and it will work?

Not at all, that's just an example so that you can see what the process is, you will have to create a form with your choices, submit it to a php script which reads the values of the choices and finally update the textfile/database.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...