duancifu6769 2011-12-27 04:33
浏览 44
已采纳

HTML表单到多个电子邮件

I have a form with 9 text fields where users can input their friends' emails. The recipients will receive HTML email in their inbox.

Question, how do I make it so that the users don't have to input in all the 9 text fields? As for now, when I just enter an email on 1 field, they will display 8 errors (for each unfilled text field)

Warning: mail() [function.mail]: SMTP server response: 503 Bad sequence of commands. You must specify the recipients of a message before you can send it in C:\httpdocs\PRM\mail-ori.php on line 62

  • 写回答

1条回答 默认 最新

  • dongpa3109 2011-12-27 04:52
    关注

    Your Form fields.

        <input type="text" name="email[]" />
        <input type="text" name="email[]" />
        <input type="text" name="email[]" />
        <input type="text" name="email[]" />
        <input type="text" name="email[]" />
        <input type="text" name="email[]" />
        <input type="text" name="email[]" />
        <input type="text" name="email[]" />
        <input type="text" name="email[]" />
    

    If you remove the nulls your program will not throw any errors. Write this bellow condition in action form.

        <?php
        $AllEmails=$_REQUEST['email'];
    
        // To remove nulls.
        $emails=array_filter($AllEmails);
    
        for($itr=0; $itr<count($emails); $itr++)
        {
            echo "Sent the mail to mail_ID: ".$emails[$itr];
        }
        ?>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 chaquopy python 安卓
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 有没有帮写代码做实验仿真的
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥30 vmware exsi重置后登不上
  • ¥15 易盾点选的cb参数怎么解啊
  • ¥15 MATLAB运行显示错误,如何解决?
  • ¥15 c++头文件不能识别CDialog
  • ¥15 Excel发现不可读取的内容
  • ¥15 关于#stm32#的问题:CANOpen的PDO同步传输问题