如何在FormMail PHP中发送复选框的多个选项?

时间:2016-08-15 19:49:11

标签: php arrays forms

我有这个选项,我可以使用FormMail PHP的所有选项:

<div class="form-checkbox">
    <label for="modulo-1"><input type="checkbox" class="" name="Modulo" id="modulo-1" value="Simples Led" /> Simples Led</label>
</div>
<div class="form-checkbox">
    <label for="modulo-2"><input type="checkbox" class="" name="Modulo" id="modulo-2" value="Simples Solar" /> Simples Solar</label>
</div>
<div class="form-checkbox">
    <label for="modulo-3"><input type="checkbox" class="" name="Modulo" id="modulo-3" value="Simples Eólico" /> Simples Eólico</label>
</div>

但是,我的档案PHP不会发送所有选中的选项。

这是我在PHP中的formMail。它创建了一个列表,但我可以在表单中发送所有选中的选项。

function parse_form($array) {
   $reserved_keys[] = "MAX_FILE_SIZE";
   $reserved_keys[] = "required";
   $reserved_keys[] = "redirect";
   $reserved_keys[] = "formlimpo";
   $reserved_keys[] = "require";
   $reserved_keys[] = "path_to_file";
   $reserved_keys[] = "recipient";
   $reserved_keys[] = "subject";
   $reserved_keys[] = "bgcolor";
   $reserved_keys[] = "text_color";
   $reserved_keys[] = "link_color";
   $reserved_keys[] = "vlink_color";
   $reserved_keys[] = "alink_color";
   $reserved_keys[] = "title";
   $reserved_keys[] = "missing_fields_redirect";
   $reserved_keys[] = "env_report";      $reserved_keys[] = "acao";

   if (count($array)) {
      while (list($key, $val) = each($array)) {
         $reserved_violation = 0;
         for ($ri=0; $ri<count($reserved_keys); $ri++) {
            if ($key == $reserved_keys[$ri]) {
               $reserved_violation = 1;
            }
         }
         if ($reserved_violation != 1) {
            if (is_array($val)) {
               $contenttemp = "<b>$key:</b><br>";
               for ($z=0;$zcount($val);$z++) {
                  $contenttemp .= "$val[$z]<br>";
               }
               $contenttemp .= "<br>\n";
               $content .= $contenttemp;
            } else {

                  if ($val) {
              $content .= "<span style='font-family: arial; font-size: 14px;'><b>$key</b> $val</span><br><hr style='border-top: 1px solid #ccc;border-bottom: 1px solid #fff;'>\n";
                  }
            }

         }
      }
   }
   return $content;
}

0 个答案:

没有答案