2017-07-07 72 views
0

处理程序不处理select with name =“ordertype”。我试着写正常的代码,我的错误在哪里?请帮助我,谢谢你花时间!如何为处理程序编写teamplate

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> 

回答

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); 
+0

谢谢!在rd-mailform.tpl中一切正常? :) – Alexey

+0

你的OrdertypeState标签上还缺少一个'#',我会更新我的答案。 – crazyloonybin

相关问题