Hi Friends,

I have some dynamic text box in my screen, i have entered only one text field of the screen, after submitting the form all the values of the dynamic text box field is getting added in the database as 0 except the value i entered. i have used array method to add.

But i want to add only the value i entered in the respective text box in my database

Note:- I have enclosed the screen for your reference

Please help me to solve the issue

At present my output is

1. xxxx xxxx 1 60.00
2. xxxx xxxx 0 0
3. xxxx xxxx 0 0

My expected Output should be

1. xxxx xxxx 1 60.00

Attachments Untitled-2.jpg 28.97 KB
6 Years
Discussion Span
Last Post by Bhuvaneswari_1
			$category_item = $_POST['category_item'];
			$item_code = $_POST["item_code"];
			$uom = $_POST["uom"];
			$rate = $_POST["rate"];
			$thisqty= $_POST["thisqty"];
			$thisamt= $_POST["thisamt"];
			$limit = count($category_item);
			//echo $limit;
			for($i=0;$i<$limit;$i++) {
    		$category_item[$i] = mysql_real_escape_string($category_item[$i]);
    		$item_code[$i] = mysql_real_escape_string($item_code[$i]);
    		$uom[$i] = mysql_real_escape_string($uom[$i]);
			$rate[$i] = mysql_real_escape_string($rate[$i]);
			$thisqty[$i] = mysql_real_escape_string($thisqty[$i]);
			$thisamt[$i] = mysql_real_escape_string($thisamt[$i]);

	$query="INSERT INTO billingdata(bill_number,bill_num1,vrform,acc_category_code,category_code, item_code, item_name, uom, rate, curr_qty, curr_amount, bill_period_from, bill_period_to, cur_date, type, site, username) VALUES ('$bill_no','$bill_number','$civrform','$acc_category_code','$cate_code','".$item_code[$i]."','".$category_item[$i]."','".$uom[$i]."','".$rate[$i]."','".$thisqty[$i]."','".$thisamt[$i]."','".$_POST['bill_period_from']."','".$_POST['bill_period_to']."','".$_POST['cur_date']."','".$_POST["type"]."','$site','$_SESSION[username]')";
//echo $query;
echo "<META HTTP-EQUIV='Refresh' CONTENT='2; URL=bill_number_gens.php?site_name=$site&vrform=$civrform&bill_no=$bill_number'>";

Edited by rpv_sen: n/a


i have taken two textbox "one for product and one for qty "and by clicking add button it will add another two text box and so on...
how to save the values of these two box in database using php


Create dynamic textbox in repeater, and try it...
foreach (RepeaterItem item in Repeater1.Items)

   // Find Textbox from repeater and save to database.
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.