954,587 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

how to add dynamic text box value in Database

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.97KB
rpv_sen
Junior Poster
178 posts since Mar 2011
Reputation Points: 18
Solved Threads: 16
 

Post your PHP.

Zero13
Practically a Master Poster
624 posts since Jan 2009
Reputation Points: 120
Solved Threads: 139
 
<?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]);

if($_POST['submit']=="Submit")
{
	$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;
mysql_db_query($database,$query);
$change=mysql_insert_id();
echo "<META HTTP-EQUIV='Refresh' CONTENT='2; URL=bill_number_gens.php?site_name=$site&vrform=$civrform&bill_no=$bill_number'>";
}
			}
?>
rpv_sen
Junior Poster
178 posts since Mar 2011
Reputation Points: 18
Solved Threads: 16
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: