I am new to PHP. I have a form like that:
<form action="mailtest.php" method="post" name="mail_form" id="mail_form" >
...
</form>
and mailtest.php has the following code:
<?php
$name=$_POST['form_name'];
if ((!isset($name)) || ($name==''))
{
echo 'Fill in the name';
}
else
{
$name='From '.$_POST['form_name'];
echo $name;
}
?>
Now, I want to put inside mailtest.php javascript code which will affect the form in case form_name is null.For example, make a hidden div show up as to indicate the obligation of filling this field or change border color etc. In other words, validation staff I'd have to do with a js file called via onsubmit event. How may I realise this inside my PHP file? Thank you