Page 1 of 1
helo
Posted: Wed Oct 26, 2011 12:30 am
by jauson
does anyone here knows how to implement reject/approve button before inserting to database?
i have created online leave form. when a users applied for a online leave. I want the notification will sent via email to the HR manager. but I want to have approve/reject button when the hr receives the notification.
Re: helo
Posted: Wed Oct 26, 2011 1:32 am
by manohoo
There's not such button that can perform the magic you are looking for.
However, what you can do is this:
1. Store user submitted records in a temporary table
2. Generate email to HR
3. When HR logs in, present leave request for approval
4. Update affected database table(s)
5. Generate email to user informing of HR decision
Makes sense?
Re: helo
Posted: Wed Oct 26, 2011 1:47 am
by social_experiment
I'm no expert on temporary tables but wouldn't a temporary table be dropped when the connection is closed by the person submitting the query? Just curious
What is a SQL Server Temporary Table?
Re: helo
Posted: Wed Oct 26, 2011 1:56 am
by manohoo
No, I didn't mean "temporary" in a volatile sense, but a table to host records that require approval from HR. Once HR has a say on the request, then move the record to whatever table is used for storing requests.
Another approach, that wouldn't require a temporary table, would be to have a "status" field on the requests table, then manage the logic based on the content of this field. For example, when the user creates the request, then the status becomes PENDING, when HR logs into the system the PENDING records are presented for approval, then the status changes to APPROVED or REJECTED.
Re: helo
Posted: Wed Oct 26, 2011 2:01 am
by social_experiment
Ah ok, yeah the status option is possibly your (OP) best option here
Re: helo
Posted: Wed Oct 26, 2011 6:49 am
by jauson
manohoo thanks for a wonderful idea. bytheway do you hve a script for temporary table for stored data?
Re: helo
Posted: Wed Oct 26, 2011 11:25 am
by manohoo
No, I don't have a script that can work with your system, nobody does, as only you know your database schema and PHP code.
I prefer my 2nd option: add a STATUS field to your "leave request" table as I indicated in a previous post. It will take some MYSQL and PHP knowledge to achieve the end result though. There's no generic script that will accomplish that for you.
Good luck!