Jump to content

Counter Help for absolute newbie


eliktris

Recommended Posts

Hi there, i am an extreme newbie to Javascript and know basically nothing about it..  i have a current client that i have volunteered my time for. things are getting to be a bit tedious and can only imagine it will get worse as it gets closer to the event.. anyhow i'm hoping someone here can help me (i'm begging!!), basically what i have a counter on a page that with each registration for a particular event, i manually go and update the counter on how many participants it is going to have (on a separate page from the registration) i'm hoping that what can be done, is for each time someone hits submit, that i can have it automatically increase the number by 1. i was originally thinking it was a php script (i'm just starting with that one) but someone on the php forum here suggested it should/could be done with javascript.

 

anyone have any advice??

 

thanks so much in advance

eliktris

 

 

Link to comment
Share on other sites

No, you can't do that with Javascript alone because you need to save the values. Javascript runs on a user's browser and would need to interact with a server-side script to get the latest number.

 

You need a php script that queries the database for the total number of rows in the registration table. You can use asynchronous javascript to get that value from the php script and update the number on the screen at regular intervals if the user is sitting on the page long enough. I suggest you use a javascript library for this, like Mootools. Look into Request and Periodical.

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.