How to echo on same html page after form submit?

wazza

New Member
How can I display the echoed messages from the PHP after the form has submitted somewhere on the html page(maybe inside a div or input field) without redirecting to the empty PHP page so that the content of my site remains visible?\[code\]<form method="post" action="../form.php"><input type="submit" name="1" value="http://stackoverflow.com/questions/14385867/YES" /><input type="submit" name="1" value="http://stackoverflow.com/questions/14385867/NO" /></form>\[/code\]-\[code\]<?php $answer = $_POST['1']; if ($answer == "YES") { echo 'Good!!!'; }else { echo 'Try Again!';} ?>\[/code\]
 
Back
Top