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

时间:2022-09-25 15:30:53

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.

我有一个带有提交按钮的表单,按下它时会将内容通过电子邮件发送到一个电子邮件地址。然后将电子邮件手动转发给rota系统上的3个人中的一个。

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.

是否有任何方式提交按钮可以工作,以便当第一个网站访问者点击它时,查询将发送给工作人员1,当下一个工作人员完成时,查询将发送给工作人员2,当下一个工作人员执行时,它将转到工作人员成员3,然后在下一个成员1时回到工作人员1。

Any help would be greatly appreciated.

任何帮助将不胜感激。

4 个解决方案

#1


0  

Make a column in database for current active_member

在数据库中为当前active_member创建一列

set 0 default value.

设置0默认值。

get first staff member from database with column active_member value 0

从具有列active_member值0的数据库中获取第一个工作人员

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

当您向该工作人员发送邮件时,将列active_member设置为1。

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

当没有成员具有active_member值列值0时,将所有值重置为0。

#2


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:

使用PHP会话存储服务器变量,例如:next_email_recip。在PHP文件的顶部,您需要放置:

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:

在PHP代码中,有一个简单的数组:

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

#3


0  

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.

最好的解决方案是存储要在表中使用的电子邮件地址(email_address_table),并且每个提交都在一个单独的表(sent_table)中,然后每次访问者点击提交,在保存并发送(sent_table)之前,它会检查是什么在(sent_table)中使用的最后一个电子邮件地址,并检查(email_address_table)列表中的下一个电子邮件地址,保存并发送它,这样您就可以确保获得均匀分布。更进一步,您可以在(email_address_table)中添加一个字段(关闭),这样如果有人不再使用此电子邮件地址,或者它是专用的并且此人已关闭,您将状态设置为关闭,以及轮换只会在剩下的代理人之间发生。

#4


0  

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.

是的,您可以创建一个表并将其命名为sent_emails。发送第一封电子邮件时,请在此表中输入第一封电子邮件地址。然后当第二个用户来并向他发送电子邮件时,首先检查此表,如果最后两个记录是不同的电子邮件ID,则发送到此电子邮件地址。对所有这样的新用户执行此操作,意味着在发送任何邮件之前首先检查其在此表中的条目以获取最后两条记录。通过创建新表,您还可以记录发送电子邮件的时间。

#1


0  

Make a column in database for current active_member

在数据库中为当前active_member创建一列

set 0 default value.

设置0默认值。

get first staff member from database with column active_member value 0

从具有列active_member值0的数据库中获取第一个工作人员

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

当您向该工作人员发送邮件时,将列active_member设置为1。

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

当没有成员具有active_member值列值0时,将所有值重置为0。

#2


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:

使用PHP会话存储服务器变量,例如:next_email_recip。在PHP文件的顶部,您需要放置:

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:

在PHP代码中,有一个简单的数组:

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

#3


0  

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.

最好的解决方案是存储要在表中使用的电子邮件地址(email_address_table),并且每个提交都在一个单独的表(sent_table)中,然后每次访问者点击提交,在保存并发送(sent_table)之前,它会检查是什么在(sent_table)中使用的最后一个电子邮件地址,并检查(email_address_table)列表中的下一个电子邮件地址,保存并发送它,这样您就可以确保获得均匀分布。更进一步,您可以在(email_address_table)中添加一个字段(关闭),这样如果有人不再使用此电子邮件地址,或者它是专用的并且此人已关闭,您将状态设置为关闭,以及轮换只会在剩下的代理人之间发生。

#4


0  

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.

是的,您可以创建一个表并将其命名为sent_emails。发送第一封电子邮件时,请在此表中输入第一封电子邮件地址。然后当第二个用户来并向他发送电子邮件时,首先检查此表,如果最后两个记录是不同的电子邮件ID,则发送到此电子邮件地址。对所有这样的新用户执行此操作,意味着在发送任何邮件之前首先检查其在此表中的条目以获取最后两条记录。通过创建新表,您还可以记录发送电子邮件的时间。