Jump to content

Active Form: Increments on Submission


Woodex

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/275553-active-form-increments-on-submission/
Share on other sites

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. 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.