Woodex Posted March 12, 2013 Share Posted March 12, 2013 Hello, I am having trouble creating a function that allows me to increment on submission. I've attached the html form, which I need assistance with. <div id="backgroundgrid2"> <div id="header"><u> Do they bare any resemblance to each other?</u></div><br /> <center> <img src="gallery/genrochill.jpg" width="177" height="176" /> <img src="gallery/peele.jpg" width="175" height="176" /><br /> </center> Does Genro and Jordon Peele look alike?<br /> <form id="selection" name="selection" method="post"> <input type="radio" name="choice" value="yes">Yes<br> <input type="radio" name="choice" value="no">No<br /> <input type="reset" name="submit" value="Submit" /> </form> Voters who said yes are: <label id="yes">0</label><br /> Voters who said no are: <label id="no">0</label><br /></div> The goal is to simply adjust the counter located within the label by one per submission. All help would be appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/275553-active-form-increments-on-submission/ Share on other sites More sharing options...
.josh Posted March 15, 2013 Share Posted March 15, 2013 You can't do this with javascipt. You have to use a server-side language like php and either a flatfile or database. Basically the idea is whenever the form is submitted, the php script will retrieve the current value from the flatfile or database, increment the value by one, store the new value in the flatfile or database, and output the new value in the label. In principle it is exactly like a "page view" or "hit counter" script, so google that for tutorials. Quote Link to comment https://forums.phpfreaks.com/topic/275553-active-form-increments-on-submission/#findComment-1418753 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.