what if you have 1000 records, are you going to output all 1000 IDs?
to reduce network traffic/page refresh, you can resort to methods like hidden frame, remote scripting, activex component like XMLHTTP to verify if the entered ID is already in the database