Selamat sore mas? saya punya koding seperti berikut :
<?php
					$po= $nextNoTransaksi;
					$no=1;
					$sql="select * from purchase_detail where po_code = '$po'";
					$query=mysql_query($sql);
					while ($r=mysql_fetch_array($query)){
					$id=$r['id'];
				
					?>
					<tbody>
					<tr>
							<td><input type="text" name="id" value="<?php echo "$id"; ?>" id="small" readonly="id"></input> </td>
					        <td><?php echo $r['po_code']; ?> </td>
                            <td style="text-transform:capitalize;"><?php echo $r['product_name']; ?></td>
                            <td style="text-transform:uppercase;"><?php echo $r['product_code']; ?></td>
                           	<td style="text-transform:capitalize;"><?php echo $r['design']; ?></td>
							<td><?php echo $r['description']; ?></td>
                            <td><input type="text" [b]name='<?php echo "price$no" ;?>'[/b] value='<?php echo $r['price'];  ?>' onkeyup="grandTotal()" id="fixed" class="price" /></td>
							<td style="text-align: center;">x</td>
                            <td><input type="text" [b]name='<?php echo "qty$no" ;?>'[/b] value='0' id="small" onkeyup="grandTotal()" class="qty"/></td>
                           	<td align="right"><input type="text" [b]name='<?php echo "total$no" ;?>'[/b] value="0" onkeyup="grandTotal()" id="fixed" class="total"  readonly='<?php echo "total$no" ;?>' /></td>
							<td><a href="home.php?source=delete-cart-po&code=<?php echo $r['product_code'];?>&PONumber=<?php echo $nextNoTransaksi;  ?>" onclick='return confirm("Are you sure to delete this data?");'><img src="images/icons/default/trash.png" title="Delete Data" /></a></td>
					</tr>
					
					<?php 
					$no++;
					?>
kalau manggil misal NAME='price', kan $_post ...
Nah untuk memanggil data dari name='<?php echo "total$no" ;?>' bagaimana ya mas Ellyx?
Terimakasih
Silahkan login untuk menjawab!
-3
Loading...
Ellyx Christian · Nov 15, 2012 · 1 Suka · 4 Tidak Suka
jangan bikin NAME formnya seperti itu, bikin seperti ini:
name="total[<?php echo $no?>]"
jadi $_POST akan berupa array
0
Loading...
ant · Nov 16, 2012 · 0 Suka · 0 Tidak Suka
Tetep gak kebaca mas: ini scriptnya:
<?php
					$po= $nextNoTransaksi;
					$no=1;
					$sql="select * from purchase_detail where po_code = '$po'";
					$query=mysql_query($sql);
					while ($r=mysql_fetch_array($query)){
					$id=$r['id'];
				
					?>
					<tbody>
					<tr>
							<td><input type="text" name="id" value="<?php echo "$id"; ?>" id="small" readonly="id"></input> </td>
					        <td><?php echo $r['po_code']; ?> </td>
                            <td style="text-transform:capitalize;"><?php echo $r['product_name']; ?></td>
                            <td style="text-transform:uppercase;"><?php echo $r['product_code']; ?></td>
                           	<td style="text-transform:capitalize;"><?php echo $r['design']; ?></td>
							<td><?php echo $r['description']; ?></td>
                            <td><input type="text" name="price[<?php echo $no ?>]" value='<?php echo $r['price'];  ?>' onkeyup="grandTotal()" id="fixed" class="price" /></td>
							<td style="text-align: center;">x</td>
                            <td><input type="text" name="qty[<?php echo $no?>]" value='0' id="small" onkeyup="grandTotal()" class="qty"/></td>
                           	<td align="right"><input type="text" name="total[<?php echo $no?>]" value="0" onkeyup="grandTotal()" id="fixed" class="total"  readonly="total[<?php echo $no?>]" /></td>
							<td><a href="home.php?source=delete-cart-po&code=<?php echo $r['product_code'];?>&PONumber=<?php echo $nextNoTransaksi;  ?>" onclick='return confirm("Are you sure to delete this data?");'><img src="images/icons/default/trash.png" title="Delete Data" /></a></td>
					</tr>
					<?php 
					$no++;
					
					//update detail
					$price=$_POST['price'];
					$qty=$_POST['qty'];
					$total=$_POST['total'];
					$sql2="update purchase_detail set price='$price',qty='$qty',total='$total' where po_code='$po'";
					mysql_query($sql2);
					?>