评论表未进入数据库
问题描述:
我正在为我的网站创建票务系统,现在它不会发送到我的数据库。现在我无法找出它出错的地方。所以我希望你们能帮助我。评论表未进入数据库
这里是我的代码:
<?php
error_reporting(E_ALL); ini_set('display_errors', 1);
include('connect.php');
session_start();
echo "Aan deze pagina word gewerkt, gebruik deze niet zolang wij hier mee bezig zijn";
//filled check
if (isset($_POST["username"]) && isset($_POST["email"])&& isset($_POST["nummer"])&& isset($_POST["comment"])){
$username = $_POST["username"];
$email = $_POST["email"];
$nummer= $_POST["nummer"];
$comment= $_POST["comment"];
//prepered insert and finished message
$stmt = $connection->prepare("INSERT INTO `comments` (username,email,nummer,comment) VALUES(?,?,?,?)");
$stmt->bind_param("ssss", $username, $email, $nummer, $comment);
$stmt->execute();
$msg = "De reparatie is aangevraagd. Er zal binnenkort contact met u worden op genomen.";
}
?>
<!DOCTYPE html>
<html>
<body>
<title>mytitle</title>
<div id="wrapper">
<head>
<link rel="stylesheet" href="styles.css">
</head>
<h1 id=logo>
<a href=""> </a>
</h1>
<?php
if(isset($msg) && !empty($msg)){
echo $msg;
}
?>
<div class="ticket-form">
<h1>Reparatie aanvraag</h1>
<form action="" method="POST">
<p><label>            Uw naam : </label>
<input id="username" type="text" name="username" required placeholder="Uw naam hier" /></p>
<p><label>                 E-Mail : </label>
<input id="email" type="text" name="email" required placeholder="[email protected]" /></p>
<p><label>Telefoonnummer : </label>
<input id="nummer" type="text" name="password" required placeholder="uw telefoonnummer hier" /></p>
<p><label>       Omschrijving van het probleem : </label>
<textarea name="comment" rows="5" cols="40" required placeholder="Omschijving van het probleem"></textarea></p>
<input class="btn tick" type="submit" name="submit" value="Verstuur reparatie aanvraag" />
</form>
</div>
</div>
</body>
</html>
,然后有提到contact.php。 (这个人是工作,我将它用于其他形式的报名。)
<?php
$servername = "localhost";
$username = "sqluser";
$password = "Welkom01!";
$dbname = "users";
$connection = mysqli_connect($servername, $username, $password);
if (!$connection){
die("Database Connection Failed". mysqli_error($connection));
}
$select_db = mysqli_select_db($connection, $dbname);
if (!$select_db){
die("Database Selection Failed" . mysqli_error($connection));
}
?>
比较遗憾的是乱码IM仍然使其更好,更容易阅读。
答
从代码:
<p><label>Telefoonnummer : </label>
<input id="nummer" type="text" name="password" required placeholder="uw telefoonnummer hier" /></p>
变化name="password"
到name="nummer"
+0
确保你在提交之前刷新表单。在代码中看不到更多的错误。检查它是否在阻止。 – hasnat 2014-11-14 21:12:30
+0
即时对不起,我删除了反应,因为它的作品现在我编辑了错误的东西(测试页,我有)。我现在觉得很蠢,但是谢谢你! – 2014-11-14 21:13:56
我们需要一些更多的细节。你可以编辑你的问题,并包括你得到的任何错误消息。 – dan08 2014-11-14 21:05:24
多数民众赞成这个问题,它不会给我任何错误,它只是不会添加任何东西 – 2014-11-14 21:07:07
'$ nummer = $ _POST [“nummer”];''和'名称=“密码”最有可能的配对。你不能只依靠“id”id =“nummer”' – 2014-11-14 21:07:44