How to get WordPress post ID of last visited page?

It would be best to include this in your link. For example, the link to your form could be https://domains.com/form/?product=20. That way the product ID will be available as as GET parameter, eg $_GET['product'].

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