PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Sat Dec 07, 2019 11:19 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: HTML/PHP business logic
PostPosted: Tue Dec 06, 2016 9:26 pm 
Offline
Forum Newbie

Joined: Tue Dec 06, 2016 9:02 pm
Posts: 1
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


Top
 Profile  
 
PostPosted: Tue Dec 06, 2016 11:39 pm 
Offline
Site Administrator
User avatar

Joined: Wed Aug 25, 2004 7:54 pm
Posts: 13592
Location: New York, NY, US
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.
Syntax: [ Download ] [ Hide ]
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>
 

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.

_________________
(#10850)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: tonyjack and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group