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
https://forums.phpfreaks.com/topic/156046-counter-help-for-absolute-newbie/
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.

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.