从php中弹出的bootstrap模式保存时,记录不保存到数据库中

时间:2014-05-09 11:53:05

标签: php jquery mysql twitter-bootstrap twitter-bootstrap-3

我想使用bootstrap模式弹出提交数据库中的数据,但是当我按下提交按钮时没有任何反应,我认为用于提交记录的页面也没有被调用。下面是模态弹出窗口的代码:我已经调用了addProducts.php页面但是在点击提交时没有调用它,请帮助解决它。感谢..

   <div class="modal fade" id="myModal">
    <div class="modal-dialog">
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
          <h4 class="modal-title">Add Products Details</h4>
        </div>
        <div class="modal-body">
          <div class="row">
            <div class="col-lg-12">
              <form role="form" name="Insertdb" method="post" action="Insert_code/add-products.php">
                <div class="row">
                  <div class="col-lg-4">
                    <div class="form-group">
                      <label>Product Name</label>
                    </div>
                  </div>
                  <div class="col-lg-6">
                    <input class="form-control" name="prodName" placeholder="Enter product Name">
                  </div>
                </div>
                <div class="row">
                  <div class="col-lg-4">
                    <div class="form-group">
                      <label>Product Price</label>
                    </div>
                  </div>
                  <div class="col-lg-6">
                    <input class="form-control" name="prodPrice" placeholder="Enter product price">
                  </div>
                </div>
                <div class="row">
                  <div class="col-lg-4">
                    <div class="form-group">
                      <label>Product Type</label>
                    </div>
                  </div>
                  <div class="col-lg-6">
                    <input class="form-control" name="productType" placeholder="Enter product type">
                  </div>
                </div>
                <div class="row">
                  <div class="col-lg-4">
                    <div class="form-group">
                      <label>Product Description</label>
                    </div>
                  </div>
                  <div class="col-lg-6">
                    <textarea class="form-control" name="productDesc" rows="3"></textarea>
                  </div>
                </div>
               </form>
            </div>
          </div>
        </div>
        <div class="modal-footer">
          <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
          <input name="button1" type="submit" class="btn btn-primary"> 
        </div>
      </div>
      <!-- /.modal-content --> 
    </div>
    <!-- /.modal-dialog -->
    </div>
    </div>



<? 
require_once('user.inc.php'); 
$Users = new Users();

$name=$_REQUEST['prodName'];
$price=$_REQUEST['prodPrice'];
$type=$_REQUEST['productType'];
$description=$_REQUEST['productDesc'];

$query="INSERT INTO tbl_product(`product_name`,`product_desc`,`product_price`,`product_type`)
VALUES('".$name."','".$description."','".$price."','".$type."')";


if(!executeQuery($query))
{
echo '<script language="javascript">';
echo 'alert("An error occured. Please try again")';
echo '</script>';
  else
    {
echo '<script language="javascript">';
echo 'alert("Record Successfully Inserted")';
echo '</script>';
}
?>

0 个答案:

没有答案