knimbus Posted June 1, 2006 Share Posted June 1, 2006 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 More sharing options...
scott100 Posted June 1, 2006 Share Posted June 1, 2006 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 More sharing options...
knimbus Posted June 1, 2006 Author Share Posted June 1, 2006 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 Link to comment Share on other sites More sharing options...
scott100 Posted June 1, 2006 Share Posted June 1, 2006 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<{POST_SNAPBACK}> 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 More sharing options...
Little Goat Posted June 1, 2006 Share Posted June 1, 2006 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 More sharing options...
knimbus Posted June 1, 2006 Author Share Posted June 1, 2006 ok, err... I dont understand this... What do you mean about a textfile? Are you saying just create a form like that and it will work? Link to comment Share on other sites More sharing options...
justsomeguy Posted June 1, 2006 Share Posted June 1, 2006 They are saying that you need to store the totals somewhere, such as a text file, or maybe a database. If you are keeping track of votes, you need to store the vote totals somewhere, right? Link to comment Share on other sites More sharing options...
scott100 Posted June 1, 2006 Share Posted June 1, 2006 Are you saying just create a form like that and it will work?<{POST_SNAPBACK}> 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now