I believe what you are wanting to do goes beyond even strict HTML. I believe you want JavaScript for this. Try posting in a JavaScripting forum, and you'll probably get an answer pretty quickly.
P.S. I love the justifying effort you make in searching for an answer for help with this statement here: "working along with PHP and SQL" Good luck. Someone here probably knows the answer, and will help. I, for one, don't know the answer. Just speculating and trying to guide you in the right direction for applicable help.