correct validate inputs

Try $name = trim( sanitize_user( $_POST['name'], true ) );

Be sure that the function does what you want! Read here

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