looking for some solutions? You are welcome.

SOLVED: How to insert multiple `product` with multiple other variables in purchase order form

Nitin Gandhi:

I have 10 rows of following code in my purchase order form. Where user add value manually

<input type="text" name="name[]" />
<input type="text" name="code[]" />
<input type="text" name="rate[]" />
<input type="text" name="tax[]" />
<input type="text" name="amount[]" />

In some cases if the purchase order is only for 3 items then the rest of 7 rows will be blank. So how can I create an Insert query to add only filled cell value in Product_purchased table according to the values of their respective rows.

$name = $_POST['name'];
$code = $_POST['code'];

foreach( $name as $names ) {
print $names ;

The above code will combine all the names but I want value of a rows in it, an array like

array ("name" => Product 1, "code" => P30, "rate" => 1000, "tax" => 12, "amount" => 1120)

and then submit it in an Insert query.

Posted in S.E.F
via StackOverflow & StackExchange Atomic Web Robots

No comments: