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
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. 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.