如何为处理程序编写teamplate

时间:2017-07-07 09:58:37

标签: php phpmailer

处理程序未使用name =“ordertype”处理select。我尝试编写普通代码,我的错误在哪里?请帮帮我,谢谢你花时间!

https://pastebin.com/mbmiapg2(rd-mailform.tpl)

https://pastebin.com/mL1HdhhS(rd-mailform.php)

 <!-- RD Mailform-->
              <form data-form-output="form-output-global" data-form-type="contact" method="post" action="bat/rd-mailform.php" class="rd-mailform text-left">
                <div class="form-group"><span class="icon material-icons-person"></span>
                  <label for="contact-name" class="form-label">Full name</label>
                  <input id="contact-name" type="text" name="name" data-constraints="@Required" class="form-control">
                </div>
                <div class="form-group"><span class="icon material-icons-markunread"></span>
                  <label for="contact-email" class="form-label">Email</label>
                  <input id="contact-email" type="email" name="email" data-constraints="@Email @Required" class="form-control">
                </div>
                <div class="form-group"><span class="icon material-icons-phone"></span>
                  <label for="contact-phone" class="form-label">Phone</label>
                  <input id="contact-phone" type="text" name="message" data-constraints="@Numeric @Required" class="form-control">
                </div>
                <div class="form-group"><span class="icon material-icons-add"></span>
                  <!--Select 2-->
                  <select data-placeholder="Тип заявки" name="ordertype" data-minimum-results-for-search="Infinity" data-constraints="@Required" class="form-control select-filter">
                    <option value="">empty</option>
                    <option value="2">Консультация</option>
                    <option value="3">Заказ</option>
                  </select>
                </div>
                <button type="submit" class="btn btn-salem">Оставь заявку сейчас!</button>
              </form>

1 个答案:

答案 0 :(得分:0)

在您的rd-mailform.php文件中,您的变量名称中有一个下划线,因此您要将详细信息分配给未使用的新变量。您在#标记上也遗漏了OrdertypeState

你有

$_template= str_replace(
        array("<!-- {OrdertypeState} -->", "<!-- #{FromOrdertype} -->"),
        array("Ordertype:", $_POST['ordertype']),
        $template);

而不是

$template= str_replace(
        array("<!-- #{OrdertypeState} -->", "<!-- #{FromOrdertype} -->"),
        array("Ordertype:", $_POST['ordertype']),
        $template);