开发者

Evenly Rotate And Check And Then Submit The PHP Form

In the following code there is a form that simply asks for an email. Below the email there are 3 checkboxes, one per agent (salesperson). When you check an agent, the emai开发者_运维技巧l is written only on that agent account, when you click another agent, the email is written on that other agent's account, etc.

The checkboxes will not be visible for the end user.

What i need to do is to evenly rotate and check one agent, then for the next form submission, the next agent, then for the next form submission the following aget, etc, etc. It needs to be real rotation, (first lead for natalie, second for jonh, third for peter, fourth for natalie and on and on and on)

Code: http://jsfiddle.net/UMXL2/

Please check out the code above, here is an example of a possible scenario: User lands on that forms, inputs email and click submit and then automatically the email goes to natalie, the next user who submits the form, it will go to the next agent, etc.

I cant think of any possible solution to solve it.


You need to store the current position in the rotation on the server-side somewhere. You can't manage this with JavaScript on the client-side. If you track the total number of submissions in a database, or even just a text file, total submissions % total agents will give you an index you can use in an array of agent email addresses.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜