In my page updel.php
I have this code:
$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);
}
and in my log.php
I have this code:
require_once('../includes/updel.php')
But when I try to load my log.php
, without even pressing a button I get the javascript alert of:
Gebeurtenis field must be filled
I tried a lot of things but I don't know what causes this problem. Can anyone help me out?
If needed, this is my code for submitting the form:
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>