helo

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jauson
Forum Contributor
Posts: 111
Joined: Wed Oct 05, 2011 12:59 am

helo

Post 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.
User avatar
manohoo
Forum Contributor
Posts: 201
Joined: Wed Dec 23, 2009 12:28 pm

Re: helo

Post 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?
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: helo

Post 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?
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
User avatar
manohoo
Forum Contributor
Posts: 201
Joined: Wed Dec 23, 2009 12:28 pm

Re: helo

Post 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.
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: helo

Post by social_experiment »

Ah ok, yeah the status option is possibly your (OP) best option here
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
jauson
Forum Contributor
Posts: 111
Joined: Wed Oct 05, 2011 12:59 am

Re: helo

Post by jauson »

manohoo thanks for a wonderful idea. bytheway do you hve a script for temporary table for stored data?
User avatar
manohoo
Forum Contributor
Posts: 201
Joined: Wed Dec 23, 2009 12:28 pm

Re: helo

Post 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!
Post Reply