Within a php page (call it page1) I use PHP to fill in values for a javascript function. That function completes by opening a new page (window.open) and displaying the user's selection using the following:

document.write("<INPUT Type='text' NAME='ItemID' size='4' VALUE=" + opener.items[i].ItemID + ">");

Further down in the php3 section I have a form to get the selection into the cart:

echo "<INPUT TYPE="hidden" NAME="UID" VALUE="$UID">";
mysql("$DBName","INSERT INTO TableName VALUES

Somewhere before the form I need a way to say $ItemID is equal to the value in opener.items[i].ItemID. I'm pretty new to this and manage to make progress by trial and error but am stumped. I don't understand the syntax needed and can't figure out if I have to do it within the <Script></Script> tags. Guidance is greatly appreciated.

P.S. In case you are wondering why I don't just use the original values that were input into the array from the database, long story but there is a reason.

Thanks for the help.