I have created a simple validation routine in php and i'm wanting to make sure I am doing things efficiently....
function reg_err_validation($reg_errors) {
global $woocommerce;
extract($_POST);
if($firstname == '' )
{
$reg_errors->add( 'registration-error', __( 'Please enter First Name.', 'woocommerce' ));
}
if($lastname == '' )
{
$reg_errors->add( 'registration-error', __( 'Please enter Last Name.', 'woocommerce' ));
}
if($phone == '' )
{
$reg_errors->add( 'registration-error', __( 'Please enter Phone.', 'woocommerce' ));
}
if($address1 == '' )
{
$reg_errors->add( 'registration-error', __( 'Please enter address.', 'woocommerce' ));
}
if($city == '' )
{
$reg_errors->add( 'registration-error', __( 'Please enter City.', 'woocommerce' ));
}
if($postcode == '' )
{
$reg_errors->add( 'registration-error', __( 'Please enter Postcode.', 'woocommerce' ));
}
return $reg_errors;
}
It all works correctly but would like to try and simplify it if possible.