I have a form that has action="file.php"
, That PHP file has the cheeks and outputs , I want these outputs to be on the same form page.
The form exists in an html file :
<form class="" method="post" action="file.php">
<!-- Some Form Fields -->
</form>
The file.php contains some checks and outputs like:
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$name = $_POST['name'];
if ( empty($name){
echo "Name can't be empty.";
}
}
How to show these outputs on the same page next to the form?
required
attribute in the form field and the browser will do it automatically.