Hello,

I have a app where each page has an undefined number of tables (Meaning on one page we may have 3 tables and on another we may have 15). They are all dynamically populated with values from a MySQL Database, creating a template of sorts. The idea behind this app is to allow us to pull information into the page, modify it, then save it to a different location.

To accomplish this, each row in our tables contain Inputs, where the default value is the value found in the DB.

I have this part working properly.

What I am having problems with is when I try to save this job back to the database.

I am assuming I need some "for loop" to accomplish this using some variation of the following pseudocode:

for(tableIndex = 0; tableIndex < JSON.length; tableIndex++) {
    for(row = 0; row < totalRows; row++) {   
        val1.value = row[0]; //Where 0 would be column 1 value  
    }
};

I just don't know how to get there from here.

Any and all help would be greatly appreciated.

I did not realize that this was the PHP board, I came here from google and just clicked Ask new Question or whatever. And as far as hor JSON is involved, I am sort of guessing. I need to take the values from the tables and submit each row into the MySQL DB. I am assuming I need to take the values from the tables as JSON, and use PHP to submit them, but I don't know exactly.

Member Avatar for diafol

For submitting data to a MySQL DB, you will definitely need a server-side language. How you pass the info to PHP (for example) is up to you. You can use a straight html form and send directly to the server or you can pass the data to javascript on submit click. The data in js can then be sent to a PHP file via an Ajax script. The upshot of Ajax is that it doesn't require a page refresh unlike the direct sending of a html form.

This is a straightforward script but not a small piece of work. It's beyond what I'm prepared to write from scratch in a help forum. Sorry. If you have a little play with some code, we'll certainly have a look at it and help you improve it.

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.