initial form, 1 -> message sent $name = ''; $email = ''; $phone = ''; $message = ''; $errors = new error_handling; function replace_comment_chars($string) { # Replace angle and curly brackets with square brackets, curly quotes with straight ones, and en-dash with hyphen $search = array("<", "{", "<", "}", "\\", "\xe2\x80\x98", # Left single quote - Unicode "\xe2\x80\x99", # Right single quote - Unicode "\xe2\x80\x9c", # Left double quote - Unicode "\xe2\x80\x9d", # Right double quote - Unicode "\xe2\x80\x93", # En dash - Unicode "\xe2\x80\x94", # Em dash - Unicode "\xe2\x80\xa6", # Ellipsis - Unicode chr(145), # Left single quote - Windows 1252 chr(146), # Right single quote - Windows 1252 chr(147), # Left double quote - Windows 1252 chr(148), # Right double quote - Windows 1252 chr(150), # En dash - Windows 1252 chr(151), # Em dash - Windows 1252 chr(133)); # Ellipsis - Windows 1252 $replace = array("[", "[", "]", "]", '', "'", "'", '"', '"', '-', '--', '...', "'", "'", '"', '"', '-', '--', '...'); return str_replace($search, $replace, $string); } function main() { global $name, $email, $phone, $message, $errors, $display_mode; # Has form been posted back using the "Submit" button? if (isset($_POST["b_submit_x"])) { # Yes - get input values from text boxes $name = trim($_POST['t_name']); $email = trim($_POST['t_email']); $phone = trim($_POST['t_phone']); $message = trim($_POST['t_message']); # Validate name field if (strlen($name) == 0) { # Name field is empty $errors->add( 'You need to enter your name' ); } elseif (strlen($name) > constant('MAX_LENGTH_NAME')) { # Name field is too long $errors->add( 'You entered more than '.constant('MAX_LENGTH_NAME').' characters in the "Your Name" field.  Please write something a bit shorter.' ); } if (preg_match(constant('REGEX_NAME'), $name)) { # Name field contains characters not on the whitelist $errors->add( 'You entered some characters into the the "Your Name" field which aren\'t allowed.   Only letters, numbers, spaces and the characters ". , & () - _ + \' ? ! /" are allowed. Please remove the characters which aren\'t allowed and try again.' ); } # Validate email field if (strlen($email) == 0) { # Email field is empty $errors->add( 'You need to enter your email address' ); } elseif (strlen($email) > constant('MAX_LENGTH_EMAIL')) { # Email field is too long $errors->add( 'You entered more than '.constant('MAX_LENGTH_NAME').' characters in the "Your Email Address" field.  Please write something a bit shorter.' ); } elseif (preg_match(constant('REGEX_EMAIL_CHARS'), $email)) { # Email field contains characters not on the whitelist $errors->add( 'You entered some characters into the the "Your Email Address" field which aren\'t allowed.  Only letters, numbers, spaces and the characters "- _ + . @" are allowed.  Please enter an email address which contains only the allowed characters and try again.' ); } elseif (!preg_match(constant('REGEX_EMAIL_FORMAT'), $email)) { # Email field does not match regular expression for valid email address format $errors->add( 'The email address you entered is invalid - a "." or a "@" may be in the wrong place, or missing.  Please check your email address carefully and try again.' ); } # Validate phone number field if (strlen($phone) > constant('MAX_LENGTH_PHONE')) { # Name field is too long $errors->add( 'You entered more than '.constant('MAX_LENGTH_PHONE').' characters in the "Your Name" field.  Please write something a bit shorter.' ); } if (preg_match(constant('REGEX_PHONE'), $name)) { # Name field contains characters not on the whitelist $errors->add( 'You entered some characters into the the "Phone Number" field which aren\'t allowed.   Only letters, numbers, spaces and the characters ". , & () - _ + \' ? ! /" are allowed. Please remove the characters which aren\'t allowed and try again.' ); } # Sanitize message $message = replace_comment_chars($message); # Validate message field if (strlen($message) == 0) { # Message field is empty $errors->add( 'You need to enter a message' ); } else { if (strlen($message > constant('MAX_LENGTH_MESSAGE'))) { # Message field is too long $errors->add( 'You entered more than '.constant('MAX_LENGTH_MESSAGE').' characters in the "Message" field.  Please write something a bit shorter.' ); } if (preg_match(constant('REGEX_MESSAGE'), $message)) { # Message field contains characters not on the whitelist $errors->add( 'You entered some characters into the the "Message" field which aren\'t allowed.   Only letters, numbers, spaces and the characters "! £ % & * () [] - _ + = : ; @ \' # , . ? /" are allowed. Please remove the characters which aren\'t allowed and try again.' ); } } # Were there any errors found? if ( !$errors->errors_occurred() ) { # No errors, send message email::send_contact_form_message($message, $name, $email, $phone); $display_mode = 1; } else { # Errors found, display initial form $display_mode = 0; } } } # Call main() function to process form data main() ?>

Stringed instrument repair in Manchester, UK

Contact details [go to contact page] Jack's instrument services on Myspace
errors_occurred() ) { echo($errors); } ?>





Your message has been sent - I'll get back to you shortly

Contact Jack's Instrument Services

Please get in contact with me if you have any questions, in need of any repair or setup, in need of an estimated cost or just need some some advice on anything instrument related!

I will get back to you as soon as possible to answer any queries you may have.

Please remember to leave your name, email address and phone number.

Thanks,
Jack

Business card

How to find me...

I'm based in Salford, Greater Manchester, just off Regent Road - please phone me for my address.

Tel: 07706 828 122  

Where to find me - Google Maps

Skype me Skype Me™!

Jack's instrument services on Myspace