因此,当它第一次进入页面时,它就像一个魅力。我写了反馈并按下提交按钮。数据库获取所有信息并且没有任何错误,但是当我进行刷新时,它会写入数据库,再次使用相同的反馈形式,并且根据我刷新的程度,它总是添加相同的注释...
<div class="text_style" style="margin-bottom: -30px;">Leave a review:</div><input class="bejel" style="width: 380px; height: 140px; margin-bottom: 40px;" type="text" name="comment" placeholder="Leave a comment..."><br>
<div class="text_style">Skins:</div>
<div class="select" style="margin-top: -35px;">
<select name="skins">
<option>Select your skin!</option>
<option value="jax">Pax Jax</option>
<option value="sivir">Pax Sivir</option>
<option value="singed">Riot Singed</option>
<option value="nasus">Riot Nasus</option>
<option value="twisted">Pax Twisted Fate</option>
<option value="ryze">Human Ryze</option>
<option value="kayle">Silver Kayle</option>
<option value="alistar">Black Alistar</option>
</select></div>
<div class="text_style" style="float: left;">Name:</div>
<input class="bejel" type="text" name="name" placeholder="Name">
<div class="text_style" style="float: left;">Email:</div>
<input class="bejel" type="text" name="email" placeholder="E-mail">
<input name="mod" type="submit" class="smb" value="" style="margin-bottom: 50px;">
</form>
</div>
<?php
$con = mysqli_connect("data for login");
if (isset($_POST['mod']))
{
$SQL = "INSERT INTO feedback_comment (rate, comment, name, skin, email) VALUES ('5', '$_POST[comment]', '$_POST[name]', '$_POST[skin]', '$_POST[email]')";
$result = mysqli_query($con, $SQL);
}
mysqli_close($con);
?>`
答案 0 :(得分:2)
在数据库提交代码后添加unset($_POST);
。
答案 1 :(得分:0)
所以,它们都没有真正起作用,但是我决定使用一个带有头功能的提交页面的会话,并且提交按钮没有任何功能......我无法通过标题位置仅提交到submit.php按钮按下。 `
<div class="text_style" style="margin-bottom: -30px;">Leave a review:</div><input class="bejel" style="width: 380px; height: 140px; margin-bottom: 40px;" type="text" name="comment" placeholder="Leave a comment..."><br>
<div class="text_style">Skins:</div>
<div class="select" style="margin-top: -35px;">
<select name="skins">
<option>Select your skin!</option>
<option value="jax">Pax Jax</option>
<option value="sivir">Pax Sivir</option>
<option value="singed">Riot Singed</option>
<option value="nasus">Riot Nasus</option>
<option value="twisted">Pax Twisted Fate</option>
<option value="ryze">Human Ryze</option>
<option value="kayle">Silver Kayle</option>
<option value="alistar">Black Alistar</option>
</select></div>
<div class="text_style" style="float: left;">Name:</div>
<input class="bejel" type="text" name="name" placeholder="Name">
<div class="text_style" style="float: left;">Email:</div>
<input class="bejel" type="text" name="email" placeholder="E-mail">
<input name="mod" type="submit" class="smb" value="" style="margin-bottom: 50px;">
</form>
</div>
<?php
if (isset($_POST['mod'])) {
$_SESSION['name'] = $_POST['name'];
$_SESSION['rate'] = $_POST['rate'];
$_SESSION['email'] = $_POST['email'];
$_SESSION['skin'] = $_POST['skin'];
$_SESSION['comment'] = $_POST['comment'];
header('Location:submit.php');
}`