我想知道是否有人可以检查为什么我的提交提交不好。如果我使用(isset($ _ POST)){它可以工作但当然它会向数据库插入太多记录,因为表单上有很多帖子。我尝试添加任何其他帖子名称它也行不通。感谢您阅读我的问题和帮助。
- 它不是sql连接,我故意删除了这些数据。
最佳,
Erik
编辑 - 更新了withvardump:array(' firstname' =>' dsads',' lastname' =>' dsadsadsa',       ;'','电子邮件' =>'',' weightkg' =>'', '编辑' =>' 0',' heightcm' =>'','编辑' => ;' 0','编辑' =>' 0','主要人员' =>'', ' rentalgroupname' =>'编辑','提交' =>'提交',' reservationid' => ;' 1486744492',)
<?php
$reservationid = time();
$mysqli = new mysqli("","","","") or die("Some error occurred during connection " . mysqli_error($mysqli));
if (isset($_POST['submit'])) {
$mysqli->query("INSERT INTO rxids (reservationid) VALUES('$reservationid')");
}
mysqli_close($mysqli);
?>
<form action="resvprocessor.php" method="post">
<input type="text" name="firstname" placeholder="first name"></input><br/>
<input type="text" name="lastname" placeholder="lastname"></input><br/>
<input type="date" name="datefrom" placeholder="datefrom"></input><br/>
<input type="date" name="dateto" placeholder="dateto"></input><br/>
<input type="date" name="dateofbirth" placeholder="dateofbirth"></input<br/>
<input type="text" name="email" placeholder="email"></input><br/>
<input type="text" name="weightkg" placeholder="weightkg"></input><br/>
<select name="redacted">
<option value="0">10-13kg</option>
<option value="1">14-17kg</option>
<option value="2">18-21kg</option>
<option value="3">22-25kg</option>
<option value="4">26-30kg</option>
<option value="5">31-35kg</option>
<option value="6">36-41kg</option>
<option value="7">42-48kg</option>
<option value="8">49-57kg</option>
<option value="9">58-66kg</option>
<option value="10">67-78kg</option>
<option value="11">79-94kg</option>
<option value="12">more than 95kg</option></select><br/>
<input type="text" name="heightcm" placeholder="heightcm"></input><br/>
<select name="redacted">
<option value="0">less than 148cm</option>
<option value="1">149-157cm</option>
<option value="2">167-178cm</option>
<option value="3">179-194cm</option>
<option value="4">more than 195cm</option>
</select><br/>
<select name="redacted">
<option value="0">beginner</option>
<option value="1">advanced</option>
<option value="2">expert</option></select><br/>
<input type="text" name="mainperson" placeholder="mainperson"></input><br/>
<input type="hidden" name="rentalgroupname" value="redacted"></input>
<input type="submit" id="submit" name="submit" value="submit"/>
<input type="hidden" name="reservationid" value='<?php echo $reservationid ?>'</input>
</form>
答案 0 :(得分:0)
尝试
sscanf()