I have a PHP form that I downloaded and I am trying to use validation for missing. Currently, it is taking me difference page when missing a field. I need to do either one of following:
1) reload the form with the fields that user already filled up and missing field should display in red or whatever color - Please let me know if someone know how can I solve this problem.
or
2) User gets msg box "Pls fill all the required fields" and when user clicks on it takes back to form where user left
I found on the web that msg box (client side processing) is NOT possible in PHP but it is possible javascript. Could you please let me know how can I used javascript in my php code - Here is the logic of sendeail.php
if (eregi('http:', $notes)) {
die ("Do NOT try that! ! ");
}
if(!$customer_email == "" && (!strstr($customer_email,"@") || !strstr($customer_email,".")))
{
echo "<h2>Use Back - Enter valid e-mail</h2>\n";
$badinput = "<h2>Feedback was NOT submitted</h2>\n";
echo $badinput;
die ("Go back! ! ");
}
if(empty($customer_name) || empty($customer_email) || empty($notes )) {
echo "<h2>Use Back - fill in all fields</h2>\n";
die ("Use back! ! ");
}