Jump to content

Leave request form


shannonmorris

Recommended Posts

I'm working on a "faculty application for leave" form. The contents of the form are sent via formmail.cgi to the supervisor of the department. What I would like to do is have another email sent to the person(s) covering for the person asking for leave, notifying them that they have been designated to cover the responsibilities. This email needs to include the name person asking off, the dates that need to be covered, and whether they are covering "administrative responsibilites" or "clinical resposibilities" (If one person is covering both, it would be fine for them to receive two emails.)

For example, if "Doctor X" is covering "Admin", and "Doctor Y" is covering "Clinical" then I need an email sent to "[email protected]" saying "This is to notify you that Doctor A (the person asking off) has requested that you cover administrative responsibilites from (begin date) to (end date)" Then, a similar email would be sent to "[email protected]"

 

I have a sample of the form here-

http://www.umcpsychiatry.com/dev/fac-leaverequest-test.php

 

Can I use this existing form, or will I need to re-write the whole thing using php code?

 

Thank you

Link to comment
https://forums.phpfreaks.com/topic/161117-leave-request-form/
Share on other sites

I assume you mean an array like this-

$eMail[] = array( 'Doctor X', '[email protected]' );

$eMail[] = array( 'Doctor Y', '[email protected]' );

$eMail[] = array( 'Doctor Z', '[email protected]' );

 

I guess I would need to create two arrays, one for "Admin" and one for "Clinical".

Would that be as simple as something like this?

$eMail2[] = array( 'Doctor X', '[email protected]' );

$eMail2[] = array( 'Doctor Y', '[email protected]' );

$eMail2[] = array( 'Doctor Z', '[email protected]' );

 

Unfortunately, I haven't had enough recent experience with PHP to remember how to "get" the information from the form. (Not that I was ever an expert.)

 

Link to comment
https://forums.phpfreaks.com/topic/161117-leave-request-form/#findComment-850249
Share on other sites

If you have access to a database this would be MUCH easier :)

 

You could use the in_array() function to see if the key is in there and if it matches just pull it out using $email[0] or $email[1]

 

If you had a database you could just use the ID as the <option> value and do a quick query and have all the data at your finger tips...but that's just me.

Link to comment
https://forums.phpfreaks.com/topic/161117-leave-request-form/#findComment-850286
Share on other sites

try setting the form up to require the applicant to enter the details of ther persons to cover for them if these details are not stored in a database. 

 

Also I would suggest using tickboxes for your clinical/administrative duties delema. 

 

Also use the if else statement when sending the email so the doctor doesnt receive 2 emails when covering both:

 
<?php


$email1 = $_POST['ClinicalCoverage'];  // but ill have to assign a value="[email protected]" to your options;
$email2 = $_POST['AdminCoverage'];


$message = " you must cover the for $_POST['Name']" ;

if ( $email1 == $email2 )
             { 
              //send email to 1 doctor only;
               mail("$email1" , "Subject Here", $message,
               "From: \"Sender Here\" <[email protected]>\r\n" .
               "X-Mailer: PHP/" . phpversion());

               echo ("Mail Sent");
               exit;    
             }
else        {
              //send email to clinical doctor;
               mail("$email1" , "Subject Here", $message,
               "From: \"Sender Here\" <[email protected]>\r\n" .
               "X-Mailer: PHP/" . phpversion());
              
              //send email to administarative doctor;
               mail("$email2" , "Subject Here", $message,
               "From: \"Sender Here\" <[email protected]>\r\n" .
               "X-Mailer: PHP/" . phpversion());

               echo ("Mail Sent");
                exit;
               }
?>                       

 

this is just a simple idea of what is possible.  Give it some thought and you'll figure it out.  Good luck

Link to comment
https://forums.phpfreaks.com/topic/161117-leave-request-form/#findComment-850294
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.