本文整理汇总了PHP中has_max_length函数的典型用法代码示例。如果您正苦于以下问题:PHP has_max_length函数的具体用法?PHP has_max_length怎么用?PHP has_max_length使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了has_max_length函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
if (!preg_match("/^[0-9]{1}-[0-9]{2}-[0-9]{2}-[0-9a-zA-Z]{2}-[0-9]{3}\$/", $_POST["dr_no"])) {
//DR NO. not like 1-15-09-MM-002
$_SESSION["error_messages"][] = "Invalid DR-No.";
$flag = 1;
} else {
if (check_drno($_POST["dr_no"]) === 0) {
$_SESSION["error_messages"][] = "DR-No Not in database.";
$flag = 1;
} else {
if (check_drno_approval($_POST["dr_no"]) === 0) {
$_SESSION["error_messages"][] = "DR-No Already Approved.";
$flag = 1;
}
}
}
if (!has_max_length($_POST["loc_mod"], 50) || !has_max_length($_POST["ref_drawing"], 50) || !has_max_length($_POST["reason_temp_chng"], 50) || !has_max_length($_POST["jumper_desc"], 50) || !has_max_length($_POST["remarks"], 50)) {
//text fields with over 50 length data mustn't be allowed
$_SESSION["error_messages"][] = "Text Fields Mustn't Have More Than 50 Characters.";
$flag = 1;
}
if (!preg_match("/^[0-9]{1}\$/", $_POST["tag_unit"])) {
$_SESSION["error_messages"][] = "Invalid Tag Unit.";
$flag = 1;
}
if (!preg_match("/^[0-9]{1}\$/", $_POST["tag_subsys"])) {
$_SESSION["error_messages"][] = "Invalid Tag Sub System.";
$flag = 1;
}
if (!preg_match("/^[0-9a-zA-Z]{3}\$/", $_POST["tag_sys"])) {
$_SESSION["error_messages"][] = "Invalid Tag System.";
$flag = 1;
示例2: validate_max_length
function validate_max_length($field_with_max_length)
{
foreach ($field_with_max_lngth as $field => $max) {
$field = trim($_POST[$field]);
if (!has_max_length($field, $max)) {
$errors["{$field}"] = ucfirst($field) . " is too long";
}
}
}
示例3: validate_max_lengths
function validate_max_lengths($fields_with_max_lengths)
{
global $errors;
foreach ($fields_with_max_lengths as $field => $max) {
$value = trim($_POST[$field]);
if (!has_max_length($value, $max)) {
$errors[$field] = fieldname_as_text($field) . " is to long";
}
}
}
示例4: validate_max_lengths
function validate_max_lengths($fields_max_length)
{
global $errors;
foreach ($fields_max_length as $field => $max) {
$value = trim($_POST[$field]);
if (!has_max_length($value, $max)) {
$errors[$field] = ucfirst($field) . "is to long";
}
}
}
示例5: validate_max_lengths
function validate_max_lengths($fields_with_max_lengths)
{
global $errors;
// Using an assoc. array
foreach ($fields_with_max_lengths as $field => $max) {
$value = trim($_POST[$field]);
if (!has_max_length($value, $max)) {
$errors[$field] = ucfirst($field) . " is too long.<br />";
}
}
}
示例6: validate_max_lengths
function validate_max_lengths($fields_with_max_length)
{
global $errors;
// Using an assoc array
foreach ($fields_with_max_length as $field => $max) {
$value = trim($_POST[$field]);
if (!has_max_length($value, $max)) {
$errors[$field] = fieldname_as_text($field) . " is too long.";
}
}
}
示例7: array
} else {
if ($image == 'card_6') {
$card_six = 'checked';
$pos = 5;
}
}
}
}
}
}
// User input Errors
$errors = array();
if (!has_presence($greeting)) {
$errors['greeting_blank'] = "Please provide a greeting for your E-Card.";
}
if (!has_max_length($greeting, 500)) {
$errors['greeting'] = "Please limit your greeting to 500 characters.";
}
if (!has_presence($friendfirst)) {
$errors['friendfirst_blank'] = "Please provide your friend's name.";
}
if (!has_presence($toemail)) {
$errors['toemail_blank'] = "Please provide your friend's email address.";
}
if (!has_presence($firstname)) {
$errors['firstname_blank'] = "Please provide your first name.";
}
if (!has_presence($fromemail)) {
$errors['fromemail_blank'] = "Please provide your email address.";
}
if (!has_presence($image)) {
示例8: validate_max_lengths
function validate_max_lengths($fields_with_max_lengths, $warning_me = false)
{
global $errors;
global $warnings;
// Expects an assoc. array
foreach ($fields_with_max_lengths as $field => $max) {
$value = trim($_POST[$field]);
if (!has_max_length($value, $max)) {
if ($warning_me) {
$warnings[$field] = fieldname_as_text($field) . " is too long";
} else {
$errors[$field] = fieldname_as_text($field) . " is too long";
}
}
}
}