I have three text input boxes that run the same PHP script. The PHP script checks to see if each is empty and generates a search results page. The problem is, the script gets the first input box that is full. For example, if I fill out A then B and then run the search while B is active and was the latest filled, it returns results for A. Same problem if I fill out A then C and B then C.
I’ve been trying to find a way to get the correct search without having to resort to splitting up the script and attaching each separate script to a separate input box, because making changes later would be a pain.
Attach an
onfocusevent to each box that records which box is active. Then, attach anonsubmitto the form that checks which box was last active. Blank the other two, then submit the form. Something like this (untested):HTML:
JavaScript: