我已经检查过,但没有任何东西适合我的问题,实际上看起来没什么问题。也许我只是累了,也许我只是坏,这里是代码:
<?php
if(isset($_POST['add_room'])){
include('php/connect.php');
$desc = $_POST['room_description'];
$cleaned = 1;
$cleaner = "admin";
$date = gmdate("Y-m-d H:i:s");
$sql = "INSERT INTO rooms (Desc, Cleaned, Cleaner, Time) VALUES ('$desc', '$cleaned', '$cleaner', '$date')";
mysqli_query($conn, $sql);
};
?>
<div id="slide-admin" style="display: none;" class="col-xs-offset-1 col-xs-10 col-xs-offset-1 col-md-offset-2 col-md-8 col-md-offset-2 sd-adm">
<div class="btn btn-default add_room-btn">Nytt rum?</div>
<div class="add_room" style="display:none;">
<form class="add_room-form" method="post">
<input name="room_description" class="room_description" placeholder="Rumsinfo"></input>
<input name="add_room" value="Lägg till rum" type="submit" class="btn btn-success add_room-btn-send"></input>
</form>
</div>
*硬编码的值仅用于测试目的,connect.php已经过测试并正常工作,是的,我有sql注入漏洞,只是测试。