我点击链接后尝试在div中包含一个页面,但它不起作用

时间:2017-05-17 09:44:18

标签: php html css

 **students.php page**   
     <?php 
        include('includes/studentsheader.php');
        include('includes/studentsmain.php');
        include('includes/getfooter.php');
        ?>  


    *studentsmain.php page*
        <div class="container-fluid">
        <div class="row">
        <div class="col-md-3">
        <ul class="studentslist">
        <li><a href="students.php?addstudents.php">Add Student</a></li>
        <li><a href="students.php?ViewStudent.php">View Student</a></li>
        <li><a href="students.php?UpdateStudent.php">Update Student</a></li>
        <li><a href="students.php?DeleteStudent.php">Delete Student</a></li>
        </ul>
        </div>

        <div class="col-md-9">
        <?php 

        if(isset($_GET['addstudents.php'])) 
        { 
        include('includes/addstudents.php'); 
        } 
        else if(isset($_GET['ViewStudent.php']))    {include('includes/ViewStudent.php');}
        else if(isset($_GET['UpdateStudent.php'])){include('includes/UpdateStudent.php');}
        else if(isset($_GET['DeleteStudent.php'])){include('includes/DeleteStudent.php');}
        ?>
        </div>

        </div>
        </div>

    *addstudents.php page*

    <div class="">
        <form>
      <div class="form-group">
        <label for="exampleInputEmail1">Email address</label>
        <input type="email" class="form-control" id="exampleInputEmail1" placeholder="Email">
      </div>
      <div class="form-group">
        <label for="exampleInputPassword1">Password</label>
        <input type="password" class="form-control" id="exampleInputPassword1" placeholder="Password">
      </div>
      <div class="form-group">
        <label for="exampleInputFile">File input</label>
        <input type="file" id="exampleInputFile">
        <p class="help-block">Example block-level help text here.</p>
      </div>
      <div class="checkbox">
        <label>
          <input type="checkbox"> Check me out
        </label>
      </div>
      <button type="submit" class="btn btn-default">Submit</button>
    </form>
    </div>

我试图在点击链接后在div中包含一个页面,但是当我单击添加学生链接时,它不能正常工作想要在col-md-9 div中包含addstudents.php div。 students.php放在includes文件夹之外,其他文件夹放在里面包含文件夹。当我点击addstudents链接时,没有任何事情发生

1 个答案:

答案 0 :(得分:0)

实际上,get方法正在将.替换为_。所以尝试下面的代码:

if(isset($_GET['addstudents_php'])) 
{ 
    include('includes/addstudents.php'); 
}