~
I don't get it. I don't know what you are trying to do.
You are the one that should know how to put this into a working project. What are you trying to do? Only you know this.
I can't figure out what is the problem/your question. I already wrote a working code for you. It already checks the address the user inputs on the form, and if its valid, it calls the function to add it to the db or do whatever you want. What else you want? What's up with issue with the
$address = "" meaning it's "empty"? Because it is not. That's part of the code to check if the address is valid, which you took it from
here, so you probably don't know exactly what it does.
It's hard to explain exactly what you should do when you don't really know PHP to begin with.