dopgl80062 2016-07-18 08:26
浏览 35
已采纳

在模态中插入查询

I would like to ask for some assistance when it comes to inserting details into mysql database if data are inside a modal. I have been trying to complete this sample project of mine hoping that I can use it as a portfolio in the future. Here's the modal code.

main.php

<div class="modal fade" id="registrationModalold" role="dialog">
  <div class="modal-dialog">
  <!-- Modal content-->
    <div class="modal-content">
      <!--<form action="functions/actions.php" method="POST">-->
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal">&times;</button>
          <h4 class="modal-title">Enrollment Details</h4>
      </div>
      <div class="modal-body">
        <form method="post" action="functions/actions.php">
          <h4 class="modal-title">Personal Information</h4>
          <div class="row">
          <div class="col-lg-6 col-xs-6">
            <label for="usr">Name:</label>
            <select class="form-control" name="courses">
            <?php 
              include 'ini/db.php'; //connect to database
              $sql = "SELECT distinct student_name FROM tbl_students";
              $res = mysqli_query($conn,$sql);
              echo "<option>---SELECT STUDENT---</option>";

              while ($row = mysqli_fetch_array($res)){
                echo "<option value=Course".$row['student_name'].">" . $row['student_name'] . "</option>";
              }
            ?>
            </select>
          </div><!-- ./col -->
          <div class="col-lg-6 col-xs-6">
            <label for="usr">Addres:</label>
            <input type="text" class="form-control" id="fullname">
          </div><!-- ./col -->
        </div>
        <div class="row">
          <div class="col-lg-3 col-xs-6">
            <label for="usr">Contact:</label>
            <input type="text" class="form-control" id="fullname">
          </div><!-- ./col -->
          <div class="col-lg-3 col-xs-6">
            <label for="usr">BirthDate:</label>
            <input type="text" class="form-control" id="fullname">
          </div><!-- ./col -->
          <div class="col-lg-3 col-xs-6">
            <label for="usr">Birth Place:</label>
            <input type="text" class="form-control" id="fullname">
          </div><!-- ./col -->
          <div class="col-lg-3 col-xs-6">
            <label for="usr">Gender:</label>
            <select class="form-control">
              <option id="male">Male</option>
                <option id="female">Female</option>
            </select>
          </div><!-- ./col -->
        </div>
        </br></br>
        <h4 class="modal-title">Other Information</h4>
          <div class="row">
            <div class="col-lg-6 col-xs-6">
              <label for="usr">Course:</label>
                <select class="form-control" name="courses">
                <?php 
                  include 'ini/db.php'; //connect to database
                  $sql = "SELECT crs_id,crs_name FROM tbl_courses";
                  $res = mysqli_query($conn,$sql);
                  echo "<option>---SELECT COURSE---</option>";

                  while ($row = mysqli_fetch_array($res)){
                    echo "<option value=Course".$row['crs_id'].">" . $row['crs_name'] . "</option>";
                  }
                ?>
                </select>
              </div><!-- ./col -->
              <div class="col-lg-6 col-xs-6">
                <label for="usr">Major:&nbsp<font color="red" size="2"><i>optional</i></font></label>
                <input type="text" class="form-control" id="fullname">
              </div><!-- ./col -->
            </div>
            <div class="row">
              <div class="col-lg-3 col-xs-6">
                <label for="usr">Mother's Name:</label>
                <input type="text" class="form-control" id="fullname">
              </div><!-- ./col -->
              <div class="col-lg-3 col-xs-6">
                <label for="usr">Mother's Occupation:</label>
                <input type="text" class="form-control" id="fullname">
              </div><!-- ./col -->
              <div class="col-lg-3 col-xs-6">
                <label for="usr">Father's Name:</label>
                <input type="text" class="form-control" id="fullname">
              </div><!-- ./col -->
              <div class="col-lg-3 col-xs-6">
                <label for="usr">Father's Occupation:</label>
                <input type="text" class="form-control" id="fullname">
              </div><!-- ./col -->
            </div>
          </div>
        <div class="modal-footer">
          <button name="btnregister" action="functions/actions.php" type="button" class="btn btn-default">Save</button>
          <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
         </div>
       </form>
     </div>
   </div>
 </div>
</div>

As you can see there's a button there a button which points to my actions.php which is inside another folder which is functions folder. But when I click that nothing happens.

Here's the action.php:

if (isset($_POST['btnregisters'])) {
    echo "ASASASASASASASASASASAS";
    die("asdsadsada");
}
  • 写回答

3条回答 默认 最新

      报告相同问题?

      相关推荐 更多相似问题

      悬赏问题

      • ¥15 关于#python#的问题:pytorch中 "for i, data in train_loader:" 这条语句为何报错
      • ¥20 从零开始汽车自动驾驶相关的软件学习
      • ¥30 操作系统进程实验虚拟机
      • ¥15 yolov5摄像头识别只能检测第一帧图像
      • ¥15 有没有可以下载钉钉群文件视频的软件
      • ¥15 如何用LaTeX打出如下的表格
      • ¥15 程序填空补充完整的代码一共三题
      • ¥15 在MySQL中使用while建表,报错
      • ¥15 python导入pyautogui报错,网上也没有找到解决方法如何解决?
      • ¥15 关于IPSEC和NAT SERVER同时使用的情况下,该如何解决客户端访问服务器的问题