?> " class="form-control" readonly /> </label><br /> <label>Answer<font color="red">*</font> <input type="text" name="answer1" id="answer1" class="form-control" /></label><br /> <label>Security Question 2 <input type="text" id="question2" style="width: 450px;" name="quesion2" value="<?php echo $question2; ?> " class="form-control" readonly /> </label> <br /> <label> Answer<font color="red">*</font> <input type="text" name="answer2" id="answer2" class="form-control" /></label> <br /><br /> <input type="submit" id="submit" name="submit" value="Submit" class="btn btn-primary" /> </form> <?php if (isset($_POST['submit'])) { $answer1 = strip_tags($_POST['answer1']); $answer2 = strip_tags($_POST['answer2']); $getAnswer1 = $data->getAnswer1($username); $getAnswer2 = $data->getAnswer2($username); //echo $getAnswer1; //echo $getAnswer2; if ($answer1 == "" || $answer2 == "") { echo "<font color='red'><b>Answers should not be empty!</b></font>"; } else { if ($getAnswer1 == $answer1 && $getAnswer2 == $answer2) { header("Location:changepassword.php"); } else { echo "<font color='red'><b>Security answers doesn't match!</b></font>"; } } } ?> </div>
<p>Answer:<input type="text" name="answer1" id="answer1" ></p> <div class="input-group"> <p>Security Question 2:<input type="text" id="question2" style="width: 300px;" name="quesion2" value="<?php echo $question2; ?> " readonly /> </div> <p>Answer:<input type="text" name="answer2" id="answer2"></p> <p class="submit"><input type="submit" id="submit" name="submit" value="Submit"></p> </form> <?php if (isset($_POST['submit'])) { $answer1 = $_POST['answer1']; $answer2 = $_POST['answer2']; foreach ($data->getAnswer1($username) as $getAnswer1) { $getAnswer1 = implode($getAnswer1); } foreach ($data->getAnswer2($username) as $getAnswer2) { $getAnswer2 = implode($getAnswer2); } if ($answer1 == "" || $answer2 == "") { echo "Answers should not be empty"; } else { if ($getAnswer1 == $answer1 && $getAnswer2 == $answer2) { header("Location:changepassword.php"); } else { echo "Security answers doesn't match"; } } }