I'm not sure this is the right place to put this in the forums, as it's not just PHP related, but it is to do with application design and I happen to be using PHP so here goes:
Does anyone have any examples of coding HTML forms for handling one to many relationships?
For example an invoice is a classic example of a one to many data relationship where the invoice header (client details, invoice date, etc) is on the one side and the invoice detail lines (product being purchased, quantity, cost, etc) are on the many side.
I know how to set this up on the database side of things, I just haven't found a really good method of handling this in HTML forms that let you easily and quickly add / change / delete invoice detail lines.
I guess that some AJAX would come in handy here so that there's isn't lots of page refreshing. I've looked at data grids in the past but most of them seem to be set up to display and change lines of data but not to quickly and easily add and delete lines.
Can anyone point me in the direction of something that might help me out? Any articles or examples?
There isn't really a need for Ajax unless you actually need to retrieve additional data from the server.
I was thinking along the lines of being able to click on a "delete" icon next to a detail line and then the page would remove that line from the DOM and send a request through to the server so a PHP script could delete the record from the database table.
And the same with adding a detail line, where the user could fill in the fields of a form on the page and when they submitted the form it would update the DOM to show the new detail line and fire off a request to a PHP script which would add the record to the database table.
And similar for changing existing detail lines.
The idea is to manipulate the DOM to show updates immediately and send requests to the server in the background so that the page isn't constantly refreshing. Should speed things up nicely!