How can I write this code snippet so that it echo’s the response when submitting empty fields?

Try doing a print_r() between setting the post variables and the validation to see what it thinks is in them.

echo '<pre>';
print_r( $email );
print_r( $name );
echo '</pre>';

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)