I am trying to develop an application that is a document due date system for an accounting firm. I am having trouble with how to code a certain part of the business logic. The database has a table of customers and table of documents. There is a CustomerDocuments table that has each customers documents.
The part of the website I am having trouble with is the extending of documents. Each customerdocument has a duedate which can be extended.
I present a list of customers for the user to choose. when the user submits the page it displays the customerdocuments table for that customer. then the user can select checkboxes for each document that will be extended. after the user submits this page i present the documents that they selected and allow them to key in the 'disposition date', 'next due date', and 'disposition method'.
It's at this point I am having trouble with the php code of how to post or save the user input data and loop through the documents so that I can perform a SQL begin transaction and update each document due date and insert a record to a history table and commit it if successful, and roll back if there is any error.
a little extra info. the page where the user inputs the next due date and disposition method is what I'm having trouble with. I present a list of the document name, state, city, due date(which are from a sql select statement) and then the user input fields of the 'disposition date', 'next due date', and 'disposition method'. I don't know how to save the data from the sql select statement and the user input data to a $_POST or $_SESSION so that I can then use it on the next page to execute the SQL update transaction.
Thanks,
John
HTML/PHP business logic
Moderator: General Moderators
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: HTML/PHP business logic
Since you need to pass multiple documents, each with multiple dates, you could use the array syntax for form elements to pass the values to PHP as an assoc array.
That will give you an assoc array in $_POST.
Note that in the code above I manually coded the document IDs. You will want to loop through the documents for the user and generate the date inputs for each document along with the associated text.
Code: Select all
Item: 234<br>
disposition_date: <input type="text" name="document[234][disposition_date]" value=""><br>
next_due_date: <input type="text" name="document[234][next_due_date]" value=""><br>
disposition_method: <input type="text" name="document[234][disposition_method]" value=""><br>
Item: 567<br>
disposition_date: <input type="text" name="document[567][disposition_date]" value=""><br>
next_due_date: <input type="text" name="document[567][next_due_date]" value=""><br>
disposition_method: <input type="text" name="document[567][disposition_method]" value=""><br>
Note that in the code above I manually coded the document IDs. You will want to loop through the documents for the user and generate the date inputs for each document along with the associated text.
(#10850)