form built dynamically with php, not submitting

Your form does not contain an ID. You need to replace name="form1" with id="form1".

This is because your javascript says,

onclick="document.getElementById("form1").submit();" 

which returns False, because there is no form with the ID “form1”.

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