Reputation: 119
I have a little problem here.. I have a form and I write it inside a table content, but it doesn't work.. so let me show you my code:
<table>
<form name='editpo' method=POST action='js_buat_po.php?act=caricustomer&doit=update&uid=$data[uid]'>
<tr bgcolor=$warna>
<td><input type=hidden name='iddemand' value='$data[id_demand]'>$data[barcode]</td><td><input type='text' name='nama' value='$data[nama_item]'></td>
<td>$data[id_pr]</td>
<td align=right><input type='text' name='jumlah' value='$data[jumlah]'></td>
<td align=right><input type='text' name='regane' id='regane' value='$data[hargabeli]'></td>
<td align=right>".number_format($total,0,',','.')."</td>
<td align=right> <input type=submit value='UPDATE'></form><a href='js_buat_po.php?act=caricustomer&doit=hapus&uid=$data[uid]'>Hapus</a></td>
</tr>
</form>
</table>
And when I try check the output from inspect element.. I got something like this:
<tr bgcolor="#FFFFFF">
<form name="editpo" method="POST" action="js_buat_po.php?act=caricustomer&doit=update&uid=7"></form>
<td>
<input type="hidden" name="iddemand" value="2">accesories204</td><td><input type="text" name="nama" value=" AC komplit Mitsubishi Pick Up C. T120 / 2012 merk sanden "></td>
<td>1</td>
<td align="right"><input type="text" name="jumlah" value="1"></td>
<td align="right"><input type="text" name="regane" id="regane" value="5000000"></td>
<td align="right">5.000.000</td>
<td align="right"> <input type="submit" value="UPDATE"><a href="js_buat_po.php?act=caricustomer&doit=hapus&uid=7">Hapus</a></td>
</tr>
I don't know why my code become like this, any help please?
====UPDATE============
So how to do like this, I have 1 table and dynamic which the data per tr is different, so lets say I wont to use update button per tr.. and how to create an array id for my tr identifier?
The format is like this..
<form>
<table>
<tr id='1'><td><input type='text' name='tes' value='xxx'></td><td><input type='submit' value='update'></td></tr> <--- Submit the data from tr1
<tr id='2'><td><input type='text' name='tes' value='xxx'></td><td><input type='submit' value='update'></td></tr> <--- Submit the data from tr2
</table>
</form>
How to do that? Can anyone help me?
Upvotes: 0
Views: 5762
Reputation: 2056
Format at worst should be
<form>
<table>
<tr>
<td>
<input ....>
<td>
<td>
<input type=submit value='UPDATE'>
<td>
</tr>
</table>
</form>
In reply to your update: Looks like you need two forms:
<table>
<tr>
<td>
<form ...>
<input..><input type=submit>
</form>
</td>
</tr>
<tr>
<td>
<form ...>
<input..><input type=submit>
</form>
</td>
</tr>
</table>
Upvotes: 4