在我的页面updel.php
中,我有以下代码:
$text = $_POST['detail'];
$uren = $_POST['uren'];
if (empty($text )) {
echo "<script type='text/javascript'>alert(\"Gebeurtenis field must be filled\")</script>";
}
else if (empty($uren)){
echo "<script type='text/javascript'>alert(\"Uren field must be filled\")</script>";
}
else if (isset($_POST['update'])){
$UpdateQuery = "UPDATE eventcalendar SET Detail='$_POST[detail]', Uren='$_POST[uren]' WHERE ID='$_POST[ID]'";
mysqli_query($login, $UpdateQuery);
}
在我的log.php
我有这段代码:
require_once('../includes/updel.php')
但是当我尝试加载log.php
时,即使没有按下按钮,我也会收到以下的javascript警告:
Gebeurtenis field must be filled
我尝试过很多东西,但我不知道导致这个问题的原因。任何人都可以帮助我吗?
如果需要,这是我提交表单的代码:
while($row = mysqli_fetch_array($myData)){
?>
<form action="log" method="post" name="Form">
<tr>
<input type="hidden" name="ID" value="<?php echo $row['ID']?>">
<td>
<?php echo $row['Date']?>
</td>
<td>
<textarea name="detail" cols="170" rows="3"><?php echo $row['Detail']?></textarea>
</td>
<td>
<input type="number" name="uren" min="1" max="10" value="<?php echo $row['Uren']?>">
</td>
<td>
<input type="submit" name="update" value="Update" class="fa fa-pencil button alterar">
</td>
<td>
<input type="submit" name="delete" value="Delete" class="fa fa-trash button excluir">
</td>
</tr>
</form>
答案 0 :(得分:4)
您必须检查表单是否已实际提交。为此,请使用db.default.hikaricp.dataSourceClassName=org.postgresql.ds.PGSimpleDataSource
db.default.hikaricp.dataSource.user=username
db.default.hikaricp.dataSource.password=password
db.default.hikaricp.dataSource.databaseName=mydb
db.default.hikaricp.dataSource.serverName=localhost
if(isset())