Page 1 of 1

Form processing cancel HELP

Posted: Wed Jun 07, 2006 6:12 am
by mcoelho123
How can i do to cancel a form processing if a value is blank?

Posted: Wed Jun 07, 2006 6:19 am
by anjanesh
Dont call the function that process the form !

Posted: Wed Jun 07, 2006 6:22 am
by mcoelho123
i have this

<form action="include/mail.php" method="POST" name="Mail Send" id="sendmail">

how can i do?

Posted: Wed Jun 07, 2006 6:40 am
by GM
In mail.php just put something like:

Code: Select all

$fieldName = $_POST['fieldName'];

// if you are going to store $fieldName in a database, make sure you escape it here.

if($fieldName == "") {
 Die("The field can't be blank!");
}
...
You can also put some javascript on the client side, but don't rely on this as "validation" - javascript should be seen as something to save the user waiting for a round trip to the server.