I use this dynamic lookup on my sites. It can get VERY complicated. It uses a combination of javascript, php, and database. It is NOT for begiinners.
You create a php script "validate.php";
This script would be the validation script: hand it a parameter (like an ID number), and the scrript does a database lookup.
Next you embed the validation script in an iframe in the entry page.
Next you write a javascript that changes the url of the iframe when an input field is changed.
You can really go to town on the validation script, and have it fill in input fields in the data entry page by using javascript in the validation page. The "parent" object.
For example, suppose you had 2 elements in a form on your entry page:
<form myform>
<input name=lookmeup type=text onchange=validateme();>
<input name=autoFillMe type=text>
</form>
in your validate page, based on values retrieved from the database, you could push values into the entry form:
$myvalue = $row[0];//after database lookup;
echo "<script>
window.parent.document.myform.autoFillMe.value='$myvalue';
</script>";
The traditional method is to enter a value on a form, click submit, and then to present a new page based on values submitted in the original form.