Custom setting field value not working inside add_action init hook

I found the answer. Problem was I was retrieving those setting option values outside the if statement if(isset($_POST['formvalue'])){ } and using them inside it. For that reason values were actually not pulled from database.

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