2017-07-07 87 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

相關問題