我有一个表单,它将记录插入到 table 中people
,而且,我想通过插入到另一个名为的表中来注册系统日志log
。
这是表格:
<form action="inserting.php" method="POST">
<input type="text" name="name">
<input type="text" name="mother">
<input type="text" name="address">
<input type="text" name="city">
<input type="submit" name="submit" value="Insert">
</form>
页面inserting.php
将是这样的:
<?php
if(isset($_POST['submit'])){
$insert = mysqli_query($con, "INSERT INTO people ('id', 'name', 'mother', 'address', 'city') VALUES (NULL, '$_POST[name]', '$_POST[mother]', '', '$_POST[address]', '$_POST[city]')");
$log = mysqli_query($con, "INSERT INTO log (id, name, date, time) VALUES (NULL, $_POST[name], $date, $time)");
echo $_POST['name'] . "was successfully inserted on" . $time . "of" . $date; . "."
}
?>
怎么了?怎么做?