Return value from a pop-up window


I have a problem with the popup window.
I explain the idea:

from the parent window i need some values that are in the db2 database,
and when the user for example don’t know the customer code, put in the field the name instead for example “fred”,
then i open the popup, where i receive the word “fred” and i show to the user the customers name that contents that name.

When the user has choosen from the popup the right customer name is need return
to the parent window the customer code without loose the contents of the others fields that the user
have before insert.

the popup work well, but i don’t know send back the code of the customer name
that user has choosen.

When i open the popup i use this javascript code between the FORM and /FORM tag

<a href=“popup1.php” onclick=“MM_openBrWindow(‘popup1.php?&sigla=FER?tipocf=1&customer=?fred’, ‘newwindow’,‘width=800,height=400’); return false;”
onkeypress=“MM_openBrWindow(‘popup1.php?&sigla=FER?tipocf=1&customer=?fred’, ‘newwindow’,‘width=800,height=400’); return false;”
value=“Select Field1 From LIst” title=“Esample of pop-up - Link inside - New window” target=“_blank”>pop-up1</a>

and in the HEAD and /HEAD tag i add the fuction:

<script language=“JavaScript” type=“text/JavaScript”>
function MM_openBrWindow(theURL,winName,features) {,winName,features);

Any suggestion will be appreciate.

Here is a link to a document that will answer your question.

Thank you Holmescreek for your reply,

the example work very well,

but there is the possibility to write the javascript code more flexible in the name of form, parent and child field name ?

If there were this possibility I could share with others father form the same popup child.