投稿値をデータベースに挿入する際に問題があるようですが、コーディングにエラーは見られません。私はしばらくそれを見てきましたが、すべてが正しく見えますが、フォームを使用してデータを送信すると、ページがリロードされますが、データベースにデータが挿入されません。
誰かがコーディングのエラーを特定するのを手伝ってくれれば幸いです。
ご不明な点がございましたら、お気軽にお問い合わせください。
敬具ジム
形
<?php
//Show the form if the user is a Admin
if(isset($_SESSION['username'])){
$username == $_SESSION['username'];
$results = $mysqli->query("SELECT authority FROM users WHERE username='$username' LIMIT 1");
while($row = $results->fetch_object()){
$aut = $row->authority;
}
}
if($aut == 1){
?>
<form action="index.php" method="post">
<table>
<tr>
<td> Title: </td>
<td><input type="text" name="title"></td>
</tr>
<tr>
<td valign="top"> News: </td>
<td><textarea name="information"></textarea></td>
</tr>
<tr>
<td> <input type="hidden" value="news"> </td>
<td><input type="submit"></td>
</tr>
</table> <hr>
</form>
MYSQLI
<?php
}
//Insert into the database
if(isset($_POST['news'])){
$title = $_POST['title'];
$information = $_POST['information'];
$mysqli->query("INSERT INTO `news` (`title`, `information`) VALUES ( '".$title."', '".$information."')");
}