表单提交按钮 - 每次提交时更改操作页面

I have a form with a submit button that when pressed it emails the contents to a single email address. The email is then manually forwarded to one of 3 people on a rota system.

Is there any way that the submit button could work so that when the first site visitor clicks it the inquiry goes to staff member 1, when the next one does it the inquiry goes to staff member 2 when the next one does it it goes to staff member 3 and then back to staff member 1 when the next one does it.

Any help would be greatly appreciated.

Make a column in database for current active_member

set 0 default value.

get first staff member from database with column active_member value 0

set column active_member to 1 when you send mail to that staff member.

when no member have active_member value column value 0 than Reset all value to 0.

Use PHP sessions to store a server variable, for example: next_email_recip. At the top of your PHP file, you will need to put:

session_start();
if (isset($_SESSION['next_email_recip'])) {
    $next_email_recip = $_SESSION['next_email_recip'];
    if ($next_email_recip == 3) {
        $_SESSION['next_email_recip'] = 1;
    }else{
        $_SESSION['next_email_recip'] = $next_email_recip + 1;
    }
}else{
    $next_email_recip = 1;
    $_SESSION['next_email_recip'] = 2;
}

In your PHP code, have a simple array:

$arrRecips = array(
    "1" => "bob@email.com",
    "2" => "joe@email.com",
    "3" => "fred@email.com",
);
$this_time_recip = $arrRecips[$next_email_recip];

The best solution is store the email addresses to be used in a table (email_address_table), and each submission in a seperate table (sent_table) then everytime a visitor hits submit, before it saves and gets sent (sent_table), it checks what was the last email address that was used in (sent_table), and check which one is next in the list in the (email_address_table), saves and sent it, that way you can be sure to get an even distribution. And one step further you can add a field (off) in the (email_address_table), that way if somebody is to not use this email address again or it is dedicated and this person is off, you set the status to off, and the rotation will only happen between the remaining agent.

Yes, you can create a table and name it sent_emails. When the first email is sent enter first email address in this table. Then when second user comes and email is sent to him first check this table and if the last two records are of different email ids send to this email address. Do this for all new users like this, means before sending any mail first check their entry in this table for last two records. By creating new table you will also be able to record the time at which emails were sent.