maaf mau tanya saya buat Form input data dengan window.opener dan sudah berfungsi dengan baik,, Tapi saya Punya masalah ketika yang diinputkan Lebih dari satu maka fungsi yg saya Buat ini tidak berfungsi
mohon Pencerahan
http://pastebin.com/3dTGd7C3
// halaman index.php
<form method="post" name="formDaftar" id="formDaftar">
<input type="text" name="idbarang" id="idbarang" value="" size="10" readonly=""/>
<input type="button" value="Browse" onclick="javascript:window.open('data_tabel.php?d=barang', 'Sbarang','scrollbars=yes');return false;">
<input type="text" name="barang_name" value="" readonly="">
<input type="text" name="barang_harga" value="" readonly="">
<input type="text" name="barang_bv" value="" readonly="">
<br />
<!-------Kalau dari fungsi ini Kebawah dihapus Bisa jalan gan -->
<input type="text" name="idbarang" id="idbarang" value="" size="10" readonly=""/>
<input type="button" value="Browse" onclick="javascript:window.open('data_tabel.php?d=barang', 'Sbarang','scrollbars=yes');return false;">
<input type="text" name="barang_name" value="" readonly="">
<input type="text" name="barang_harga" value="" readonly="">
<input type="text" name="barang_bv" value="" readonly="">
/////////////////////halaman data-tabel.php//////////////////////////
<?php
include_once 'connection.php';
?>
<form name="frmCari" method="post">
Barang ID : <input type="text" name="m_cari"><input type="submit" value="Cari" name="cari">
</form>
<?php
if($_POST['cari']){
$q=mysql_query("select * FROM kr_product where p_id='".$_POST['m_cari']."'");
if($q){
?>
<script type="text/javascript" language="javascript">
//<![CDATA[
function returnSponsor(id,nm,hg,bv){
var windowprops='width=100,height=100,scrollbars=yes,status=yes,resizable=yes'
var heightspeed = 2; // vertical scrolling speed (higher = slower)
var widthspeed = 7; // horizontal scrolling speed (higher = slower)
var leftdist = 10; // distance to left edge of window
var topdist = 10; // distance to top edge of window
window.opener.eval("document.formDaftar.idbarang").value=id;
window.opener.eval("document.formDaftar.barang_name").value=nm;
window.opener.eval("document.formDaftar.barang_harga").value=hg;
window.opener.eval("document.formDaftar.barang_bv").value=bv;
window.close();
}
//]]>
</script>
<table border="1" cellpadding="5" cellspacing="0">
<thead>
<tr>
<th>ID Barang</th>
<th>Nama Barang</th>
<th>Harga</th>
<th>BV</th>
</tr>
</thead>
<tbody>
<?php
while($r=mysql_fetch_array($q)){
echo "<tr>
<td><a href=\"#\" style=\"display:block;background-color:#ccc;\" onclick=\"javascript:returnSponsor('".$r['p_id']."','".$r['p_name']."','".$r['p_harga']."','".$r['p_bv']."');return false;\">".$r['p_id']."</a></td>
<td>".$r['p_cat_id']."</td>
<td>".$r['p_name']."</td>
</tr>
";
}
}
}
?>
</tbody>
///////////////////////////////////////////////////////Connnecttttion/////////////////////
<?php
$sqlhost="localhost";
$sqluser="root";
$sqlpasswd="";
$sqldb="datasaya";
$conn=mysql_connect("$sqlhost","$sqluser","$sqlpasswd") or die("<p align=center>CAN NOT CONNECT TO MYSQL SERVER</p>");
mysql_select_db($sqldb) or die("<p align=center>Warning database not exists!</p>");
?>
////////////////////////////////////////////////////////////////SQLLL///////////////////////////////
CREATE TABLE IF NOT EXISTS `kr_product` (
`p_id` varchar(5) NOT NULL,
`p_cat_id` varchar(4) NOT NULL,
`p_name` varchar(100) NOT NULL,
`p_desc` text NOT NULL,
`p_harga` int(11) NOT NULL,
`p_bv` int(11) NOT NULL DEFAULT '0',
`p_screenshoot` varchar(100) NOT NULL,
`p_view` int(11) NOT NULL,
`p_publish` enum('0','1') NOT NULL DEFAULT '1',
`p_uploaddate` datetime NOT NULL,
`p_uploadby` varchar(100) NOT NULL,
`p_stok` int(10) NOT NULL,
PRIMARY KEY (`p_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data untuk tabel `kr_product`
--
INSERT INTO `kr_product` (`p_id`, `p_cat_id`, `p_name`, `p_desc`, `p_harga`, `p_bv`, `p_screenshoot`, `p_view`, `p_publish`, `p_uploaddate`, `p_uploadby`, `p_stok`) VALUES
('200', 'K003', 'KIT', '<p>KIT Member AMC</p>', 550000, 0, '', 158, '1', '0000-00-00 00:00:00', '', 30);