重定向到另一个页面

更多的

您好,我有一个我无法解决的问题,我有两个按钮,一个用于删除,另一个用于编辑,删除工作正常,但是编辑按钮似乎无法正常工作,因此无法重定向到php文件+当重定向到另一个页面时如何使用编辑按钮获取会议名称不知道这是我的代码

 <table class="table table-striped custab" >
  <thead>
    <tr>
      <th>Title</th>
      <th>Chairman</th>
      <th>Summary</th>
      <th> Date &   Time</th>
    </tr>
    <?php

        $findMeetings = "SELECT * FROM `meeting` WHERE chairman='".$name."'";

        $result = mysqli_query($db, $findMeetings);

        $numRows = mysqli_num_rows($result);

        if($numRows == 0){

            $empty = "<div class='alert alert-danger'>You are currently managing no meetings!</div>";

        }
        else{

            $x = 0;

            while($rows = mysqli_fetch_array($result)){

                $title = $rows['title'];
                $chairman = $rows['chairman'];
                $date = $rows['time'];
                $summary = $rows['summary'];

                $meeting = "
                <tr>
                <th>".$title."</th>
                <th>".$chairman."</th>
                <th>".$summary."</th>
                <th>".$date."</th>
                <th><form method='post'>
                    <input type='submit' class='btn btn-success' name='edit".$x."' value='Edit'/>
                    <input type='submit' class='btn btn-danger' name='delete".$x."' value='Delete'/>
                </form></th>
                </tr>
                ";

                echo $meeting;

                if(isset($_POST['delete'.$x.''])){

                    $query = "DELETE FROM meeting WHERE title='".$title."' LIMIT 1";

                    if($result = mysqli_query($db, $query)){

                        header("Location:managemeeting.php");

                    }

                }



            }

        }

    ?>

  </thead>
  <tbody>

  </tbody>
</table>

因此,如何获取会议名称并将其传递到editmeeting.php会导致存在多个数据。

如果我像删除按钮那样做,就不会发生这种情况

if(isset($_POST['edit'.$x.''])){



                        header("Location:editMeeting.php");

                    }
语法Goooo

您应该<form>在每个提交按钮前加上一个环绕,并在每个提交按钮中指定action<form>以便它相对于所<form>环绕的按钮发布到正确的url

然后使用<hidden>每个字段中的字段<form>将数据传递到要发布到的URL。例子:<input type="hidden" name="row_id" value="99" />

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章