Hi there,
Please help

How to add dynamic textbox (row) and save to database using PHP PDO?

Recommended Answers

All 2 Replies

my recommendation is that you tackle one problem at a time. In additon, if you want to get members to help you, you have to show that you've done some work. Post your relevant code and tell us where you are having difficulties.

here is a snip that you can use to start workign on the first problem (how to add a row dynamically).

Assuming you have a table element, you can easily add a row using jQuery.

here is an example..numRow being a variable that holds the value of your row number.

$('#tbl1').append('<tr><td><input type="text" name="txtBox-' + numRow + '" /></td></tr>'); 

If this is within a form element you can retrieve the values when the page is posted.

code is not tested and is not meant to simply be copied and pasted into your code. You are still missing components such as an element to trigger an event for this snippet of code to execute client side.

Be a part of the DaniWeb community

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