0

我正在使用下面的代码发送网络邮件和短信通知。它工作得很好,但我只想在用户从需要服务的下拉菜单中选择“A”值并且不想在晚上 8 点到早上 5 点接收短信时接收短信。

任何帮助都非常感谢..

<form action="/thankyou.php" name="form1" method="post" >
<input type="hidden" name="curtime" />
<select name="servicerequired">
<option selected="selected" value="">Please Choose</option>
<option value="A">Replacement</option>
<option value="B">Architectural</option>
<option value="C">Commercial</option>
<option value="other">Other</option>
</select>
<input type="submit" value="submit" name="submit" />

这是PHP部分

if ($_POST['submit']) {
       $to="myemail@mydomain.com";
       $sms="mymobilenumber@domain.net";
       $subject="Online Quote";
       $from = "webmaster@mydomain.com";
       $curtime = $_REQUEST['curtime'] ;
       $service = $_REQUEST['servicerequired'] ;
       $curtime = date("Y-m-d H:i:s");
       $headers = "From: $from\r\n" .
       "MIME-Version: 1.0\r\n" .
          "Content-Type: multipart/mixed;\r\n" .
          " boundary=\"{$mime_boundary}\"";
       $message="message to email";
       $message2="message to sms";
       @mail($to, $subject, $message, $headers);
       @mail($sms, $subject, $message2, $headers);

ANS 下面 - 特别感谢@Dagon:

if ($_POST['submit']) {
           $to="myemail@mydomain.com";
           $sms="mymobilenumber@domain.net";
           $subject="Online Quote";
           $from = "webmaster@mydomain.com";
           $curtime = $_REQUEST['curtime'] ;
           $service = $_REQUEST['servicerequired'] ;
           $curtime = date("Y-m-d H:i:s");
           $headers = "From: $from\r\n" .
           "MIME-Version: 1.0\r\n" .
              "Content-Type: multipart/mixed;\r\n" .
              " boundary=\"{$mime_boundary}\"";
           $message="message to email";
           $message2="message to sms";
           @mail($to, $subject, $message, $headers);
if($_POST['servicerequired']=='A' && (date("G")>5 && date("G")<20)  ){ 
           @mail($sms, $subject, $message2, $headers);
}
4

1 回答 1

1
if($_POST['servicerequired']=='A' && (date("G")>5 && date("G")<19)  ){ 
//SMS STUFF
}
于 2013-05-08T01:12:58.170 回答