Dynamic Text box adding for each fields in the MySQL DB with PHP and Jquery



Hi friends

CODE

$("#addButton").click(function () {

if(counter>10){
alert("Only 10 textboxes allow");
return false;
}

var newTextBoxDiv = $(document.createElement('div'))
.attr("id", 'TextBoxDiv' + counter);

newTextBoxDiv.after().html('College/University<INPUT type="text" name="CUni[]"><br>'

newTextBoxDiv.appendTo("#TextBoxesGroup");

counter++;
});

This is the code i used for dynamic adding of textbox, what i need is when i click edit
according to the no of rows in my DB, the no of textbox should be dynamically added.
how can i do that?

what i said is i am using following code to generate textbox dynamically(means when i click button it add new textbox) what i need is when i load the page using mysql i am getting some data,suppose i have 4 data i need to show it on 4 textbox which should be generate using the jquery(above code) i given how can i do that,(like the education,work details section on facebook),if i have dynamically created textbox then it is easy for me to add the textbox