I’m trying to get the form’s submit button name from $_POST so that I can set the state of my page. I found an example on how to do this, but it’s not working for me. Can anyone please take a look at my code below and tell me what is wrong? Thanks much.
[CODE]if (isset($state) && $state == “Submit”) {
print_r($_POST);
extract($_POST);
if (isset($btn_Exam)) {
unset($state);
}
else if (isset($btn_Scoring) || isset($btn_Resubmit)) {
$state = “CheckAnswers”;
}
else if (isset($btn_Solutions)) {
$state = “ShowSolutions”;
}
else if (isset($btn_Summary)) {
$state = “ShowSummary”;
}
}
.
.
.
<body>
.
.
.
<form id=”form-basic-html” name=”form-basic-html” method=”post” action=”<?php echo $PHP_SELF; ?>?state=Submit”>
<?php
if (isset($state) && $state == “CheckAnswers”):
?>
<center>
<input class=”submit-button” type=”submit” id=”btn_Exam” name=”btn_Exam” value=”<< Exam” />
<input class=”submit-button” type=”submit” id=”btn_Resubmit” name=”btn_Resubmit” value=”Resubmit Answers” />
<input class=”submit-button” type=”submit” id=”btn_Solutions” name=”btn_Solutions” value=”Solutions >>” />
</center>
<?php
endif;
if (isset($state) && $state == “ShowSolutions”):
?>
<center>
<input class=”submit-button” type=”submit” id=”btn_Scoring” name=”btn_Scoring” value=”<< Scoring” />
<input class=”submit-button” type=”submit” id=”btn_Summary” name=”btn_Summary” value=”Summary >>” />
</center>
<?php
endif;
?>
.
.
.
</form>
</body>