I'm trying to make some php else if but seems to have some trouble making post method work. Here's the condition:
<?php if (!$yes_good) { ?>
<form action='/' method='post'>
<input type="hidden" name="GOOD" value="1" />
<input id="linkid" class="label" type="submit" value="" name='' />
</form>
<?php } else { ?>
<form action='/' method='post'>
<input type="hidden" name="BAD" value="1" />
<input id="linkid" class="label" type="submit" value="" name='' />
</form>
<?php
}
?>
Result page:
<?php if (isset($_POST['GOOD'])): ?>
<h1> GOOD! </h1>
<?php elseif (isset($_POST['BAD'])): ?>
<h1> BAD! </h1>
<?php else: ?>
<!-- Shows up when form is bypass or page is access directly. -->
<h1> Not GOOD or BAD </h1>
<?php endif; ?>
The php elseif post method seems not working.
Aucun commentaire:
Enregistrer un commentaire