This question already has answers here:
Answer
Solution:
You're making TWO requests to placenameclick.php.
The first one is a POST request with Ajax and the value is defined.
The second one is a GET request with browser navigation and the value is not.
The point of Ajax is to exchange data without navigation. Since you want to navigate, Ajax is the wrong tool.
Remove the JavaScript. Replace it with a regular HTML form.
Source