View Full Version : adding fields dynamically and insert their values in MySQL database

01-30-2007, 12:46 PM
Hello I am new in Javascripting and web database.
I want a code for adding dynamic combobox and texts into my form (for saving page space).
To get a little more in depth. Basically, I want the ability to add several form elements, lets say three text boxes, eg: text1, text2, text3. There is a javascript button entitled something like "add a new row", which upon execution, will append another row onto the table (or div if you will), holding another set up text boxes.
further after making this issue i want to insert their selection values into my database( i Use PHP and MySQL). How is that can be achieved.
please help me on this since i am new hired and i don't want to fail on my first assignment.

Regards to everyone.

01-30-2007, 12:59 PM
They hired you to program and you don;t know how? :thumbsup:

start with this: http://www.w3schools.com/js/tryit.asp?filename=try_dom_table_insertrow

except that your table cells would contain textboxes in the innerHTML, I guess....

i want to insert their selection values into my database( i Use PHP and MySQL).

you'll have to add a submit button to your form to submit the values to your PHP script, so that you can add them to MySQL....or you can use some AJAX to do this to avoid the page refresh...

01-31-2007, 10:31 AM
Thank you 4 ur kind reply,
I actually a web designer i make several static sites with some of dynamic sites but it doesn't include a long applications that might need for adding same field(e.g like if i request for adding customer experiences he might have only one or many experiences) that is why i want the facility of adding more fields when needed. and i am totally new in JS and i wounder how can i grap the new added fields (since i include the JS file that make the addition) and post it to MySQL.