Have a look at http://www.codingforums.com/showthread.php?t=2090
There was no need to post the whole of your code.
Styling and positioning is done with css.
It is your responsibility to die() if necessary….. - PHP Manual
All the code given in this post has been tested and is intended to address the question asked.
Unless stated otherwise it is not just a demonstration.
Last edited by Philip M; 11-14-2012 at 02:45 PM..