Posted: Wed Mar 21, 2007 6:22 am
Code: Select all
$errors = array(); $strErrorMessage = ""; if(empty($domaincompany)) { $errors['domaincompany'] = "Domain Company"; } if(empty($domainexp)) { $errors['domainexp'] = "Domain Expiry Date"; } if(empty($domainuser)) { $errors['domainuser'] = "Domain User"; } if(empty($domainpass)) { $errors['domainpass'] = "Domain Password"; } if(empty($domainregkey)) { $errors['domainregkey'] = "Domain Reg Key"; } if (count($errors)>0) { $strErrorMessage = "You must complete the following fields: <br>".implode("<br>",$errors)."<br>"; } if (!checkValidDate($domainexp)) { $strErrorMessage .= "Domain Expiry Date is not a valid date.<br>"; } if (!checkValidUser($domainuser)) { $strErrorMessage .= "Domain User is not valid.<br>"; } if (!checkValidRegKey($domainregkey)) { $strErrorMessage .= "Domain Reg Key is not valid.<br>"; } if (empty($strErrorMessage)) { $allgood = $allgood + 1; } else { $save_result = $strErrorMessage; }
Your code looks more readable, I think this will show where the error happened soon. More user friendly code