dink87522 Posted August 8, 2009 Share Posted August 8, 2009 What I had was the user clicking the submit button and it would be processed by another PHP file. If I wish to process it on the same page I understand that you use the isset function. However this will not work for me and with the submit button's action, what does that then become? <form action="check.php" method="post"> <input type="hidden" name="country" value="<?php echo("$rnd") ?>"/> <input type="text" size="55" name="answer" value="" /> <input type="submit" name="submit" value="Submit" /> </form> <?php if (isset($_POST['submit']){ $userAnswer = $_POST['answer']; $rnd = $_POST['country']; $answer = $capitals[$rnd]; $userAnswerLower = strtolower($userAnswer); $answerLower = strtolower($answer); //echo("userAnswerLower: $userAnswerLower <br />"); if ($userAnswerLower == $answerLower) { echo("<h3>CORRECT, $answer is indeed the capital of $countries[$rnd]!</h3>"); } else { echo("<h3>INCORRECT, the capital of $countries[$rnd] is $capitals[$rnd]! </h3>"); } } ?> Link to comment https://forums.phpfreaks.com/topic/169398-solved-isset-help/ Share on other sites More sharing options...
smerny Posted August 8, 2009 Share Posted August 8, 2009 if (isset($_POST['submit']) { should be if (isset($_POST['submit'])) { Link to comment https://forums.phpfreaks.com/topic/169398-solved-isset-help/#findComment-893791 Share on other sites More sharing options...
dink87522 Posted August 8, 2009 Author Share Posted August 8, 2009 Thanks Link to comment https://forums.phpfreaks.com/topic/169398-solved-isset-help/#findComment-893803 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.