Click here to Skip to main content
15,892,674 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi friends

i am generating textboxes dynamically using javascript By clicking button the java script will call and add new textbox and for every textbox different name and id is generating in loop.


i want to store those textbox values in Database how can i catch that textbox value

see my code
PHP
$('.addrownew').live('click',function(){
	if(counter>20){
            alert("you count has reached 15 ..please check once");
            return false;
	} 
var row='<div class="itemwraprow"><div class="slnodiv"></div><div class="itemdiv"><input name="item' + counter +'" id="item' + counter +'" type="text"  class="item"  önchange="selectvalue3();"/></div><div class="partnodiv"><input name="partno' + counter + 
	      '" type="text" class="partno" id="partno' + counter + 
	      '" readonly="readonly" /></div><div class="pricediv"> <input name="price' + counter + 
	      '" id="price' + counter + 
	      '" type="text"  class="price" name="price' + counter + 
	      '"/></div><div class="quantitydiv"><input name="quantity' + counter + 
	      '" type="text" id="quantity' + counter + 
	      '" class="quantity"/></div><div class="amountdiv"><input name="amount' + counter + 
	      '" id="amount' + counter + 
	      '" type="text"  class="amount"/></div><div class="addrowdiv"><img border="0" class="deleterow" src="images/cross.gif" style="display: inline; width: 18px; height: 18px;"></div>';




<div class="quantitydiv"><input name="quantity' + counter + 
	      '" type="text" id="quantity' + counter + 
	      '" class="quantity"/></div>



name will changing by count value


how can i catch that javascript generated txtbox values into PHP.
Posted
Updated 5-Feb-12 20:40pm
v2

Hi,
I have done the same thing in ASP.net so i can just give you an idea i have generated dropdown list,I am changing the ID of generated dropdown on submitting the form, and saving it in an array to retrieve value of each dropdown and this functionality is working fine
 
Share this answer
 
use print_r($_POST) or print_r($_POST) to see what data u get from which name so u can fetch and loop according to that. use foreach loop according to ur post or get array.

http://www.php.net/manual/en/control-structures.foreach.php[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900