0

Currently I am creating site wordpress.lockout.lt. One functionality is developed by me; it works fine with the default theme. Currently I am using a different one. And as well this theme requires lot of different plugins. Now, when inserting my plugin shortcode it doesn't redirect request to itself. Instead I receive a message, that "Page is not found". Form code is enclosed below. First I thought that it's related with action; I tried a lot of different things to set action properly but it didn't help me:

    $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 Answer 1

0
$formtxt .= '<form  style="width: 800px;" name="time_booking"  action="#" onsubmit="return validateCalendarForm();" method = "POST">';

action is set to #. maybe that is the cause. try removing that.

action=""

additionally a js function validateCalendarForm() is calling on form submit. so check console for errors too. and lastly refresh permalink structure

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.