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

Post your PHP.

			$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'>";

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.

First of all make database connectivity query and after run insert query .

Thk u so much for your code............ Its readlly tooooo Good...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.