I have two two “submit buttons”(multiple/displaying using loop) (inside form tag) but my problem is, form is submtting after refresh page instead of “click on submit”
I dont know where i am wrong ? Here is my code
<td class="project-state">
<form method="POST" name="status" action="" >
<input type="hidden" name="projectId" value="<?php echo $projectId; ?>">
<input type="hidden" name="UserId" value="<?php echo $projectId; ?>">
<input type="hidden" name="status" value="<?php echo "accept"; ?>">
<input type="submit" name="submit" value="Accept" class="btn btn-success">
</form>
</td>
<td class="project-actions text-right">
<form method="POST" name="reject" action="" >
<input type="hidden" name="projectId" value="<?php echo $projectId; ?>">
<input type="hidden" name="UserId" value="<?php echo $projectId; ?>">
<input type="hidden" name="status" value="<?php echo "reject"; ?>">
<input type="submit" name="reject" value="Reject" class="btn btn-danger btn-sm">
</form>
</td>
Here is my php code, but once i click on reject (showing in loop) then if i refresh page form submitting automatically instead of click on “reject”,How can i fix this ?
if(isset($_POST['reject']) && !empty($_POST['reject'])) {
echo "<pre>";print_R($_POST);
exit;
}