こんにちは、news_id
をtwitter modalに渡したいと思います。しかし、間違ったデータを取得している人誰かに私にモーダルにデータを渡す方法のアイデアを教えてもらえますか?twitter modalにデータを渡す
をニュースを削除し、削除されたデータは、news_idとニュースで私のコードです。
<div class="container">
<table class="table table-bordered" >
<thead>
<tr>
<th width="60">ID</th>
<th width="200">News Title</th>
<th width="150">Date Posted</th>
<th>Content</th>
<th width="200">Image</th>
<th width="200">Action</th>
</tr>
</thead>
<tbody>
<?php
$stmt = mysqli_prepare($con, "SELECT * FROM news ORDER BY news_id");
mysqli_stmt_execute($stmt);
$result = mysqli_stmt_get_result($stmt);
while($row = mysqli_fetch_array($result)){
?>
<tr>
<td><?php echo $row['news_id']; ?></td>
<td><?php echo $row['news_title']; ?></td>
<td><?php echo $row['news_date']; ?></td>
<td><?php echo $row['news_content']; ?></td>
<td><img style="height:150px; width:200px;" src="<?php echo $row['news_image']; ?>" ></td>
<td>
<a class='btn btn-info left-margin' href="edit2.php?newsid=<?php echo $row['news_id'];?>" ><span class="glyphicon glyphicon-edit"></span> Edit</a>
<a class='btn btn-danger delete-object' data-toggle="modal" data-target="#myModal"><span class="glyphicon glyphicon-remove"></span> Delete</a>
<div class="modal fade" id="myModal" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-body">
Are you sure you want to delete this?
</div>
<div class="modal-footer">
<a class='btn btn-danger left-margin' href="delete.php?newsid=<?php echo $row['news_id'];?>" >Yes</a>
<button type="button" class="btn btn-default" data-dismiss="modal">No</button>
</div>
</div>
</div>
</div>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
は、ここに私のdelete.php
<?php
include_once('connection.php');
$newsid = $_GET['newsid'];
if(isset($newsid)){
$stmt = mysqli_prepare($con, "DELETE FROM news WHERE news_id = ?");
mysqli_stmt_bind_param($stmt, "s", $newsid);
mysqli_stmt_execute($stmt);
header('location: edit.php');
}
?>
私の神!あなたの私のヒーロー@クリス先輩:Dありがとうマスター。 – nethken
うれしいよ:) –
サー?私たちはチャットに移動できますか? – nethken