//deal with individual form section posts
//-->Faction Name
if(isset($_POST[ factionname ])){
$unsani_faction_name = $_POST[ faction ];
$new_faction_name = str_replace(",", "", $unsani_faction_name);
$faction_name = mysql_real_escape_string($new_faction_name);
$faction_name = preg_replace( /ss+/ , , $faction_name);//strips excess white space
$faction_name = stripslashes($faction_name);//strips slashes from name
//remove special chars except: "& $ £ ^ - ( )"
$faction_name = preg_replace( /[^a-z0-9s£&$^()-]/i , , $faction_name);
$string_length = strlen($faction_name);
if($string_length < 0 || $string_length > 20) {
echo <strong>Error:</strong> Property name needs to be between 1-20 characters. ;
}else {
$sql = mysql_query("SELECT * FROM ".TBL_USERPROPBANKS." WHERE prop_name= $prop_name ");
$num_rows = mysql_num_rows($sql);
if ($num_rows > 0) {
echo <strong>Error:</strong> Bank with the same name in existance. ;
}else {
mysql_query("UPDATE ".TBL_USERPROPBANKS." SET prop_name= $prop_name WHERE prop_id= $bankid ");
header("Location: bank_cp.php?bankid=".$bankid."§ion=settings");
}
}
I m working out my errors using the above method. What is (in your opinion) the most logical way to:
- Counting the number of errors
- And echoing/printing them inside a separate section of my layout to show each error message in a list?
我现在可以想到的是,如果独一无二的变数不符合我的验证要求,那么就把无效价值分配给独一无二的var,然后用独一无二的错误信息加以填补(这将是20+不同错误)。 在这个问题上有什么想法?