I have a table with a bucnh on notes, I want to user to be able to edit the notes on a popup window.

I have the following code to pop up the window:

PHP Code:
        echo "<td><a href=\"#\" onClick=\"MM_openBrWindow('leadnoteedit.php?leads_id=".$row->leads_id."&id=".$lrow->leadnotes_id."','','directories=no,alwaysRaised=yes,toolbar=no,location=no,status=no,scrollbars=no,resizable=no,width=500,height=300')\">Edit</a></td>"
this is what the popup file looks like:

echo "<title>Lead Note Review</title>";
require_once ("/home/classica/public_html/configuration/style.php");
require_once ("/home/classica/public_html/configuration/functions.php");

$query = "SELECT * FROM leadsnotes WHERE leadnotes_id=".$id;
$result = sql($query);
$row = mysql_fetch_object($result);
echo "<table width =100% height=100%><tr>";
echo "<td bgcolor=#BBBBBB height=15><font size=2>Note was entered into system on: <b>".displaydatetime($row->datetime)."</b></font></td></tr>";
echo "<tr><td valign=top bgcolor=#EEEEEE>";
echo "<form name=form1 method=post action=selectlead.php?id=$leads_id?note_id=$id&edit=1 target=_parent>";
echo "<textarea name=note cols=85 rows=15 id=note>".$row->note."</textarea><br>";
echo "<input type=submit name=Submit value=\"Update Note\">";
echo "</form>";
echo "</td></tr>";
echo "<tr><td bgcolor=#BBBBBB align=center height=15>";
echo "<A HREF=\"javascript:window.close()\">Close this window</A>";
echo "</td></tr></table>";

I want this code to be able to have the uder edit the note and then when they click on update note it will close the popup window and call the

selectlead.php file with the new infomation

It's a java question and I have looked for an hour in many java books to figure this out and I have no luck