输入按钮在Wordpress(Bootstrap)中不起作用

问题描述 投票:0回答:1

我是PHP新手。我正在尝试使用Bootstrap样式为Wordress制作一个小插件。问题在于,直到将表单包装在<td></td>标记中之前,表单中的Submit输入元素才起作用(不可单击)。然后它开始工作(请参见下面的代码)。

<?php   wp_register_script('prefix_bootstrap', '//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js');
        wp_enqueue_script('prefix_bootstrap'); 
?>

<div class="">
<h3>Test</h3>
<div class="row">
<div class="col-sm-7"
<td>
<form method="post" action="">
  <div class="form-row">
  <div class="form-group col-md-7">
<label for="va_weight">Weight:</label>
      <input type="number" class="form-control" name="va_weight" id="va_weight" placeholder="Weight, kg" value="">
    </div>
  </div>
  <div class="form-row">
  <div class="form-group col-md-7">
    <label for="inputquantity">Number:</label>
      <input type="number" class="form-control" name="va_quantity" id="inputquantity" placeholder="Number, pcs ">
    </div>
  </div>

  <div class="form-row">
  <div class="form-group col-md-7">
    <label for="inputcost">Cost:</label>
      <input type="number" class="form-control" name="va_cost" id="inputcost" placeholder="Cost ">
    </div>
  </div>

  <div class="form-row">
    <div class="col-sm-10">
      <input type="submit" name="submit" class="btn btn-alert" value="Submit"></input>
      </br></br></br></br></br></br>
    </div>
</div>
</form>
</td>
</div>
<div class="col-sm-5"> <?php
if(($_SERVER['REQUEST_METHOD'] ?? 'GET')=='POST'&&isset($_POST['submit'])){
echo ("Your weight:" ." " .$_POST["va_weight"] ."</br>");
echo ("Number of measurements:" ." " .$_POST["va_quantity"] ."</br>");
echo ("Cost per measurement:" ." " .$_POST["va_cost"]);
}
else 
{echo ("Nothing to display");}
?></div>
</div>
</div> 

有人可以解释发生了什么吗?为什么没有<td>的输入将不起作用?

php html wordpress twitter-bootstrap submit
1个回答
© www.soinside.com 2019 - 2024. All rights reserved.