When the form is submitted, my page is redirected to the PHP and the echo is displayed. How can I display the echo without being redirected to the PHP page? So the echo should be displayed in the html page (where the html form is located).
<form method="post" action="../form.php">
<input type="submit" name="1" value="YES" />
<input type="submit" name="1" value="NO" />
</form>
–
<?php
$answer = $_POST['1'];
if ($answer == "YES") {
echo 'Good!!!';
}
else {
echo 'Try Again!';
}
?>
I guess you can use a combination of
<iframe>and javascript to get the results.