Lead Rotator Script

I’m trying to figure out how to create a rotator script for lead generation where every single form submission will rotate to a new person then go back to the first person in the database. How would I go about doing this?

I was thinking that I would need to set a number in the database on which record count it was on and then increment it by one. Upon the last record it resets to “0” or the first record. This is what I’m thinking.

Does anyone know of a tutorial or code snippet that would do something like this? Or is there a better way of doing this?

There’s a few ways you can do this. One way:

In a db table containing the names of those receiving the forms, add a column with a number in it being the order of people you want the form submissions to go to. In another table, store the order number of the person who received the last form submission. Then on each form submission, get the order number of the previous submission, increment it by 1 or set to 1 if needed and then assign the form to the next person in the loop.