does anyone have any idea why $_POST
not being set??
here is some of the code.
JavaScript
x
<form method="post" name="form" id="clientForm" action="">
<input type="submit" name="sub" value="Delete_Checked"/>
<?php if ($i%2){ ?> class="even"<?php } ?>
<input type="checkbox" name="doc[]" value="<?php echo $document->doID; ?>"/>
<?php $i++; } ?>
</form>
<?php
if (isset($_POST['sub']) == 'Delete_Checked'){
print_r($_POST['sub']); // nothing gets print.......
}
?>
i must be overlooking something.
Advertisement
Answer
JavaScript
if (isset($_POST['sub']) == 'Delete_Checked'){
This is not how it should be written. It will only work by accident.
What the author wanted to write was:
JavaScript
if (isset($_POST['sub']) && ($_POST['sub'] == 'Delete_Checked')) {
I would personally leave out the whole isset
part, because that’s exactly what’s obstructing your assessment of the cause.