Submit to itself don't work

时间:2017-02-05 作者:Antas R

目前我正在创建网站wordpress。锁定。lt.一个功能由我开发;它可以与默认主题配合使用。目前我正在使用另一个。这个主题也需要很多不同的插件。现在,当插入我的插件短代码时,它不会将请求重定向到自身。相反,我收到一条消息,“找不到页面”。表格代码附在下面。首先,我认为这与行动有关;我尝试了很多不同的方法来正确设置操作,但都没有帮助我:

    $formtxt .= \'<form  style="width: 800px;" name="time_booking"  action="#" onsubmit="return validateCalendarForm();" method = "POST">\';
    $formtxt .= \'<div class="w3-row-padding" align = "center"  width="800 px">\';
    $formtxt .=\'<table style = "text-align: center;" id = "timeslotstable" width="800 px" border="1">\';
    $formtxt .=\'<caption>\'.$table_name.\'</caption>\';

          $formtxt .=\'<tr>\';

          $formtxt .=\'<tr>\';  // time value begin
          $formtxt .=\'<th width="100 px"></th>\'; // time value end
          for ($j = 0; $j < 7; $j++) {      

                   $formtxt .=\'<th width="100 px" >\'.date_format($actual_date,"Y-m-d").\'</th>\';
                   date_add($actual_date,date_interval_create_from_date_string("1 days"));
           }

         $formtxt .=\'</tr>\';



    for ($i = 0; $i < $periods_count; $i++) {      

         $actual_date= clone $monday;
         $formtxt .=\'<tr>\';  // time value begin

                  $visit_time = $start_time  + $i*$period_len;
                  $formtxt .=\'<td>\'.gmdate("H:i", $visit_time).\'</td>\'; // time value end


                 for ($j = 0; $j < 7; $j++) {                    

                             $notexist = 0;
                             foreach ($activereservationslist as $result) {

                                    if ($result->visit_time ==  date_format($actual_date,"Y-m-d").\' \'.gmdate("H:i", $visit_time) ) {
                                          $notexist = 1;      
                                    }
                             } 


                             if ($notexist == 1 or date_format($actual_date,"Y-m-d") <= date("Y-m-d") ){                                
                                       $formtxt .=\'<td  bgcolor = "red" align ="center" >\';                                 
                             } else {
                                       $formtxt .=\'<td style="text-align:center;" bgcolor = "green" >\';                                 
                                       $formtxt .=\'<input  style="w3-radio" type="radio"  name="time_selection" id="time_selection" value="\'.date_format($actual_date,"Y-m-d").\' \'.gmdate("H:i", $visit_time).\'">\';
                             }


                            date_add($actual_date,date_interval_create_from_date_string("1 days"));
                   }

         $formtxt .=\'</tr>\';

    }
    $formtxt .=\'</table>\';
               $formtxt .=\'<div id="errftimeselection"></div>\';

                $formtxt .=\'<div class="w3-row-padding" width="800 px">\';   

                if ($page >1 ) {                    
                  $formtxt .=\'<input class="button button-xsmall button-line-dark" type="submit" align ="left" name= "previousweek" id= "previousweek" value="Buvusi Savaite" onclick="previousweekfocus()">\'; 
                }


                if ($page <13 ) {                                        
                  $formtxt .=\'<input class="button button-xsmall button-line-dark" type="submit" align ="right" name= "nextweek" id= "nextweek" value="Sekanti Savaite" onclick="nextweekfocus()"> <br>\';
                }



                $formtxt .=\'</div>\';   
                $formtxt .=\'<div class="w3-row-padding">\';  
                $formtxt .=\'<div class="w3-half">\';    
                $formtxt .=\'<p>\';
                $formtxt .=\'<label for= "nameval">Vardas Pavardė</label>\';
                $formtxt .=\'<input class="w3-input w3-border w3-round" name="nameval" id="nameval" type="text" onblur="validateName()"><div id="errfname"></div></p>\';
                $formtxt .=\'<p>\';
                $formtxt .=\'<p>\';
                $formtxt .=\'<label for="email">Email</label>\';
                $formtxt .=\'<input class="w3-input w3-border w3-round" type="email"  name="email" id="email" onblur="validateEmail()"/><div id="errfemail"></div>\';                        
                $formtxt .=\'<p>\';
                $formtxt .=\'<p>\';
                $formtxt .=\'<label for="phone_number" >Mob. tel.</label>\';
                $formtxt .=\'<input class="w3-input w3-border w3-round" id="phone_number" name="phone_number"  placeholder = "8 XXX XXXXX" type="text" onblur  = "validatePhone()"/><div id="errfphonenumber"></div>\';                        
                $formtxt .=\'<p>\';
                $formtxt .=\'<input type="hidden" name="room"  value="\'.$room.\'"/>\';
                $formtxt .=\'<input type="hidden" name="activepage"  value="\'.$page.\'"/>\';
                $formtxt .=\' <label for= "payment_type">Apmokėjimo būdas </label>\';
                $formtxt .=\' <select class="w3-select w3-border" name = "payment_type" id = "payment_type" onChange="paymtypeselector(this)">\';
                $formtxt .=\'  <option value="local">Vietoje</option>\';
                $formtxt .=\'  <option value="ebank">Pavedimu</option>\';
                $formtxt .=\'  <option value="coupon">Kuponas</option>\';
                $formtxt .=\'  </select>\';   
                $formtxt .=\'<p>\';
            $formtxt .=\'<label id ="couponidtxt" for = "couponid">   Kupono nr. </label>\';
                $formtxt .=\'<input class="w3-input w3-border w3-round" type="couponid" id = "couponid" name="couponid" /><div id="errfcouponid"></div>\';     
                $formtxt .=\'</div>\';
                $formtxt .=\'<div class="w3-half">\';
                $formtxt .=\'<label><font color="blue">    </font></label>\';                        
                $formtxt .=\'<p>\';
                $formtxt .=\'<p></p>\';
                $formtxt .=\'<label><font color="blue"> Jei reikalinga Sąskaita Faktūra: </font></label>\';     
                $formtxt .=\'<p></p>\';
                $formtxt .=\'<p>\';
                $formtxt .=\'<label for="company_id">Įmonės pavadinimas</label>\'; 
                $formtxt .=\'<input class="w3-input w3-border w3-round" name="company_name" id="company_name" type="text" >\';      
                $formtxt .=\'<p>\';
                $formtxt .=\'<label for="company_id">Įmonės kodas</label>\';
                $formtxt .=\'<input class="w3-input w3-border w3-round" name="company_id" id="company_id" type="text">\';      
                $formtxt .=\'<p>\';
                $formtxt .=\'<label for= "vat_id">PVM mok. kodas</label>\';
                $formtxt .=\'<input class="w3-input w3-border w3-round" name="vat_id" type="text">\';      
                $formtxt .=\'</div>\';
                $formtxt .=\'</div>\';
                $formtxt .=\'<p>\';
                $formtxt .=\'<input class="button button-xsmall button-line-dark" type="submit" align ="center" name= "cf_submitted" value="Rezervuoti"> <br>\'; 
                $formtxt .=\'<p>\';



    $formtxt .=\'</div>\';

    $formtxt .=\'</form>\';
                 $formtxt .= \'</div>\';
                  return $formtxt;

1 个回复
SO网友:Anwer AR

$formtxt .= \'<form  style="width: 800px;" name="time_booking"  action="#" onsubmit="return validateCalendarForm();" method = "POST">\';
操作设置为#。也许这就是原因。尝试删除该选项。

action=""
另外还有一个js函数validateCalendarForm() 正在调用表单提交。所以也要检查控制台是否有错误。最后刷新permalink结构

相关推荐

无法在模板函数.php中使用IS_HOME

我试图在标题中加载一个滑块,但只在主页上加载。如果有帮助的话,我正在使用Ultralight模板。我正在尝试(在template functions.php中)执行以下操作:<?php if ( is_page( \'home\' ) ) : ?> dynamic_sidebar( \'Homepage Widget\' ); <?php endif; ?> 但这行不通。现在,通过快速的google,我似乎需要将请