$value) {
$form_sql = "SELECT * FROM `".WPSC_TABLE_CHECKOUT_FORMS."` WHERE `id` = '$value_id' LIMIT 1";
$form_data = $wpdb->get_results($form_sql,ARRAY_A);
$form_data = $form_data[0];
$bad_input = false;
if($form_data['mandatory'] == 1) {
switch($form_data['type']) {
case "email":
if(!preg_match("/^[a-zA-Z0-9._-]+@[a-zA-Z0-9-.]+\.[a-zA-Z]{2,5}$/",$value)) {
$any_bad_inputs = true;
$bad_input = true;
}
break;
case "delivery_country":
if(($value != null)) {
$_SESSION['delivery_country'] == $value;
}
break;
default:
break;
}
if($bad_input === true) {
switch($form_data['name']) {
case __('First Name', 'wpsc'):
$bad_input_message .= __('Please enter a valid name', 'wpsc') . "";
break;
case __('Last Name', 'wpsc'):
$bad_input_message .= __('Please enter a valid surname', 'wpsc') . "";
break;
case __('Email', 'wpsc'):
$bad_input_message .= __('Please enter a valid email address', 'wpsc') . "";
break;
case __('Address 1', 'wpsc'):
case __('Address 2', 'wpsc'):
$bad_input_message .= __('Please enter a valid address', 'wpsc') . "";
break;
case __('City', 'wpsc'):
$bad_input_message .= __('Please enter your town or city.', 'wpsc') . "";
break;
case __('Phone', 'wpsc'):
$bad_input_message .= __('Please enter a valid phone number', 'wpsc') . "";
break;
case __('Country', 'wpsc'):
$bad_input_message .= __('Please select your country from the list.', 'wpsc') . "";
break;
default:
$bad_input_message .= __('Please enter a valid', 'wpsc') . " " . strtolower($form_data['name']) . ".";
break;
}
$bad_input_message .= "
";
} else {
$meta_data[$value_id] = $value;
}
} else {
$meta_data[$value_id] = $value;
}
}
$new_meta_data = serialize($meta_data);
update_usermeta($user_ID, 'wpshpcrt_usr_profile', $meta_data);
}
?>