I want to ask about my php coding..
I am doing some array coding but when I submit my data, in my database is will display an array at the description and qty column..
I use mysql..
Below is my array coding..
$item = array(
item_description => ,
price => ,
qty => ,
amount => ,
);
foreach ($item as $key => $value){
$item_description = $_POST[ item_description ][$key];
$price = $_POST[ price ][$key];
$qty = $_POST[ qty ][$key];
$amount = $_POST[ amount ][$key];}
}
我插入了疑问。
$sql1="INSERT INTO payment_item (payment_id, payment_item_id, item_description, price, qty, amount)
VALUES
( $last_insert_payment_id , NULL , $_POST[item_description] , $_POST[price] , $_POST[qty] , $_POST[amount] )";
这是我的形式:
<form>
<h1>Payment Item</h1>
Payment ID :<input id="payment_id" name="payment_id" type="text"><br>
<input type="button" value="Add Row" onClick="addRow( tableID )"/>
<input type="button" value="Delete Row" onClick="deleteRow( tableID )"/>
<table class="table" bgcolor="#CCCCCC">
<thead>
<tr>
<td></td>
<td><center>Item Description</center></td>
<td><center>Price (RM)</center></td>
<td><center>Month</center></td>
<td><center>Amount (RM)</center></td>
</tr>
</thead>
<tbody id="tableID">
<tr>
<td><input type="checkbox" name="chk"></td>
<td>
<select name="item_description">
<option value="deposit">Deposit</option>
<option value="rental">Rental</option>
<option value="stamp">Stamp Duty</option>
<option value="process">Process Fee</option>
<option value="ap">AP</option>
</select>
</td>
<td><input id="price" name="price" type="text"></td>
<td><input id="month" name="qty" type="text"></td>
<td><input id="amount" name="amount" type="text"></td>
</tr>
</tbody>
</table>
<input name="submit" type="submit" value="Submit">
<input name="reset" type="reset" value="Reset">
</form>
I am sorry for my poor english language..
But I really need any help from someone for this..
Thank you..