If input field has value Require another field – PHP

You can do this:
if (isset($_POST['twosfn']) && !empty($_POST["twohn"]))

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