こんにちは、私は問題を解決できませんでした。私は2つのボタンを1つは編集していますが、削除は完璧に機能していますが、編集ボタンは機能していないようですそれは別のページにリダイレクトされますときに私は編集ボタンで会議名を取得する方法+ 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");
}
多くの方法がありますが、編集したいデータベース行のIDを編集スクリプトに渡すだけで、編集スクリプトはデータベース情報自体を取得しますまたは、編集ページで使用できる形式で非表示の入力を実行できます。しかし、2つのフォームを使用し、それぞれのフォームで 'action =" somefilehere'syoureditfile "を指定する必要があります。 (私が見る限り、deletebuttonは同じスクリプトを呼び出すので、その上に空を置くことができます – junkfoodjunkie
"編集"に関連するものは表示されません。そのためのボタンです。 –
@Fred -ii-はい、私はそれを行う方法がわからないので、私はそれを削除ボタンと同じようにし、editmeting.phpに何も起こらないようにヘッダを書いてください。 – ziyad