joined:June 30, 2008
I'm looking the the best or better solution when testing for changed html form fields prior to sql table updates.
I have a html form that supplies data to multiple sql tables via PHP. I currently pass all form fields to my PHP script where i have "if" test blocks that tests all input fields for each table by comparing input and table fields. I realize this is not the best way to handle whether a table needs to be updated.
I hind site, it would have been better to test a boolean variable that represents the block of fields for each table in the form and either send only the form fields for that table to the PHP sql table update script. But i don't want to do a major rewrite to the html/javacsript/php code, so i'd settle for replacing the PHP "if" test blocks with a single boolean test variable for each table that is passed along with the data.
Upon some research, there seems to be a few methods floating around.
serialize the form before and after user submit then test.
Serializing the form and comparing seems to be the easiest thing to do.
I would appreciate your opinions.