Search the Community
Showing results for tags 'required'.
-
If you use <input required> how do you stop it from allowing just spaces and how do you make sure there is a minimum entry of 8 non spaces. Thanks
-
i was trying to make error message relating from the w3schools learning center but it returned nothing. please help me find the error.... here is the code i wrote... <?php// define variables and set to empty values$cnameErr = $dateErr = $itemErr = $rateErr = $qtyErr = "";$cname = $date = $rfn = $item = $rate = $qty = $less = $amt = "";if ($_SERVER["REQUEST_METHOD"] == "POST"){ if (empty($_POST["cname"])) {$cnameErr = "Customer Name is required";} else {$cname = test_input($_POST["cname"]);} if (empty($_POST["date"])) {$emailErr = "Date is required";} else {$date = test_input($_POST["date"]);} if (empty($_POST["rfn"])) {$rfn = "";} else {$rfn = test_input($_POST["rfn"]);} if (empty($_POST["item"])) {$itemErr = "Item name is required";} else {$item = test_input($_POST["item"]);} if (empty($_POST["rate"])) {$rateErr = "Please input Rate";} else {$rate = test_input($_POST["rate"]);} if (empty($_POST["qty"])) {$qtyErr = "Please input item quantity";} else {$qty = test_input($_POST["qty"]);} if (empty($_POST["less"])) {$less = "";} else {$less = test_input($_POST["less"]);} if (empty($_POST["amt"])) {$amt = "";} else {$amt = test_input($_POST["amt"]);}}function test_input($data){ $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); return $data;}// error messageecho $dateErr; // and so on?>