Pass table column value from popup to parent button onclick

I want to pass a table column value from popup window to the parent window!! here is ,my code below:

/////here is the code of parent window,where i want the value to be passed! ////

<html>
<body>
<form method="post" action="" name=f1>
<input type=text name='p_name' size='8'> 
<a href="javascript:void(0);"  onClick=window.open("child3.php","Ratting","width=550,height=170,left=150,top=200,toolbar=1,status=1,");>Click here to open the child window</a>
</form>
</body>
</html> 

/////here is the code of popup window,where i have a table,from where i want the column value of a particular row ////

<html>
<head>

<script langauge="javascript">
function post_value(){
opener.document.f1.p_name.value = document.frm.c_name.value;
self.close();
}
</script>

<title>Test</title>
</head>


<body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#800080" alink="#ff0000">

<?php
echo "
<form name=\"frm\" method=post action=''>
<table border=0 cellpadding=0 cellspacing=0 width=250>


<tr><td align=\"center\"> Your name <input name=\"c_name\" type=button value='testi' onclick=\"post_value();\">
</td>
<td align=\"center\"> Your name <input name=\"c_name\" type=button value='testi' onclick=\"post_value();\">
</td></tr>
</table></form>
";
?>
</body>
</html>

//////////////////////////////////////////////
here my main problem is that when i have only one

in my popup table,it plays OK. but when i have put two then it cant pass the value, & then the parent textbox get the value named “undefined”!!!
Can anyone give me any suggestion??? Plzzz! thanx in advance!!
Sponsor our Newsletter | Privacy Policy | Terms of Service