Nodoid Nodoid - 10 months ago 63
HTML Question

Submit button not hitting isset() call

I have a PHP form set like this

<?php if (isset($submitted)) {
$output = checkData();
if (!is_null($output))
echo '<script type="text/javascript">alert("' . $output . '"); </script>';
echo '<script type="text/javascript">alert("You meeting has been created. All of the recipients should shortly receive an email"); </script>';
header('Location: index.php');
} else { ?>
<form method="POST">
<input type="submit" name="submitted" value="Create Meeting">

When I run it through a PHP code checker (codechecker website), no errors are returned. However, when I click on the submit button, the isset($submitted) code never seems to be executed (I've tested this by adding some echo statements in that section of the code).

If I click on the submit button, the form is cleared, so something is happening. I've put a number of different actions in, but the code is still not hit.

Answer Source

This if (isset($submitted))... should be if (isset($_POST['submitted']))...