If you ‘have’ to do it this way, you should add the following line to the top of your above your include functions line:
require('/path/to/yourdomain.com/httpdocs/wp-blog-header.php');
global $wpdb; // In case you need DB calls also
@milo is correct though and you should think of a better way of doing this…
Alternatively, you could look at Gravity Forms or Contact Form 7 plugins which both have in built validation and allow customisation.