1

原谅我,但我认为我的技能水平太深了:数据库连接设置在包括:

这是代码:

<html>
  <body>
      <?php
      include "inc.php";
      //print_r ($_POST);


      //if "email" is filled out, send email
      if (isset($_POST['email']))

      {
          //send email
          While($row=mysql_fetch_array($querymail))
          {
              $to= $row['email'];
              $subject = $_REQUEST['subject'] ;
              $message = $_REQUEST['message'] ;
              $email= 'stats@my email.com';
              mail($to, $subject,
              $message, "From:" . $email);
              echo "email sent to ".$to;
          }
      }
      else
      //if "email" is not filled out, display the form
      {

          $Pnum=implode(',',$_POST['checkemail']);
          $querymail=mysql_query("select sp.email_address as email from stats_player sp where sp.player_num IN ($Pnum)");
          While($row=mysql_fetch_array($querymail))
          {
              echo "<table>";
              echo "<tr><td>".$row['email']."</tr.</td>";
          } 
          echo "<form method='post' action=''>

          Subject: <input name='subject' type='text'><br>
          Message:<br>
          <textarea name='message' rows='15' cols='40'>
          </textarea><br>
          <input type='submit'>
          </form>";
      }
  ?>
  </body>
</html>

当我允许时,print_r ($_POST);我会按预期显示所有 player_nums。

该页面以正确的电子邮件列表打开(此表将消失,仅用于验证数据),我得到了表单。

当我点击表单上的提交按钮时,我得到了错误。

Warning: implode() [function.implode]: Invalid arguments passed in /home..../results/admin/emailall.php on line 31

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home..../results/admin/emailall.php on line 33

我认为,因为我有这个表格重新提交给自己,所以它正在清除我在初始查询中的内容。我以为我已经用 isset 绕过了它,但我可能(可能是)错了。

(注意我在粘贴时删除了一些空行,因此错误行将不对应)

4

0 回答 0