Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Darryl Schneider
2,628 PointsNeed help with a form for TIME OFF on company website. Can someone put me on the right direction please?
When an employee submits the form, the Human Resource Manager gets an email notification, info@kozelsteel.com. Problem: The MANGER does not get notified at all. The Human Resource Manager then has to email the manager regarding the requested time off.
The whole point of this form is to notify the Human Resource Manager and the Manager instantly.
Thanks!
Darryl Schneider
2,628 PointsAshley,
Let me know if this is okay.
Thanks!
Darryl
<?php
// CREATE LIST $list = array ( $FirstName = $_POST[FirstName], $LastName= $_POST[LastName], $Manager = $_POST[Manager], $Type = $_POST[Type], $DatesRequested= $_POST[DatesRequested], $HoursRequested= $_POST[HoursRequested], $HoursApproved= $_POST[HoursApproved], $HoursAvailable= $_POST[HoursAvailable], $Notes= $_POST[Notes] );
// ADD REQUEST DATE $list[] = date('c');
// WRITE TO CSV FILE $fp = fopen('/home/kozel/public_html/employees/timeoff_requests.csv', 'a+');
fputcsv($fp, $list);
fclose($fp);
$Msg = "Employee Time Off Request
Name: $FirstName $LastName Manager: $Manager Request type: $Type Dates Requested: $DatesRequested Hours Requested: $HoursRequested Hours Currently Approved: $HoursApproved Hours Available: $HoursAvailable Notes: $Notes
Click the following link to download a spreadsheet containing all timeoff requests: http://www.kozelsteel.com/employees/timeoff_requests.csv
";
$recipient = "bmitch@thetoolranch.com" . "," . "$Manager";
mail("$recipient", "Website Time Off Request", $Msg, "From: info@kozelsteel.com\nReply-To: bmitch@thetoolranch.com\nX-Mailer: PHP/" . phpversion());
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Kozel Steel, Rochester NY</title> <link href="../code/kozel.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="../code/swfobject.js"></script> </head>
<body> <H1 style="margin-bottom: 0">Beams - Columns - Structural Steel - Fabrication & Erection - Roof Deck - Reinforcing Steel - Wire Mesh</H1> <p style="margin-top: 0; margin-bottom: 0;"> </p> <div id="container"> <div id="masthead"><img src="../images/kozel-steel.jpg" alt="" width="1000" height="150" border="0" usemap="#Map" /> <map name="Map" id="Map"> <area shape="rect" coords="736,128,990,144" href="mailto:info@kozelsteel.com" alt="Email Us" /> </map> </div> <div class = "line15"> <p style="margin-top: 0; margin-bottom: 0;"> </p> <div class = "lefty"> <ul class="lefty" style="margin-bottom: 0">
<li><a href="../index.html"><img src= "../images/m1.gif" alt="Home" border="0"/></a></li>
<li><img src="../images/mspace.gif" /></li>
<li><a href="../company-history.html"><img src= "../images/m2.gif" alt="Company History" border="0"/></a></li>
<li><img src="../images/mspace.gif" /></li>
<li><a href="../products-services.html"><img src= "../images/m3.gif" alt="Products & Services" border="0"/></a></li>
<li><img src="../images/mspace.gif" /></li>
<li><a href="../request-quote.html"><img src= "../images/m4.gif" alt="Request Quote" border="0"/></a></li>
<li><img src="../images/mspace.gif" /></li>
<li><a href="../our-employees.html"><img src= "../images/m5.gif" alt="Our Employees" border="0"/></a></li>
<li><img src="../images/mspace.gif" /></li>
<li><a href="../downloads.html"><img src= "../images/m6.gif" alt="Downloads" border="0"/></a></li>
<li><img src="../images/mspace.gif" /></li>
<li><a href="../kozeldirect"><img src= "../images/m7.gif" alt="Online Store" border="0"/></a></li>
</ul>
</div>
</div>
<div class = "line2"> </div>
<div id="contentTopper"> </div>
<div id="contentWrapper">
<p style="margin-top: 0; margin-bottom: 0;"> </p>
<div id="content">
<h2>Thank you for your request!</h2>
<p style="margin-bottom: 0;">We will process your time off request. You will be advised regarding your request. If you have any questions in the meantime, contact the office at 585.436.9807.</p>
</div>
<p style="margin-top: 0; margin-bottom: 0;"> </p>
<div id="sidebar">
<h3> </h3>
<p> </p>
<p> </p>
</div> </div> <div id="contentFooter"> </div> <div id="pageFooter"> <a href="../employees"><img src= "../images/m8.gif" alt="Employee Login" border="0"/></a></div> </div> </body> <script type="text/JavaScript"> <!-- function MM_preloadImages() { //v3.0 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++) if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}} }
function MM_swapImgRestore() { //v3.0 var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc; }
function MM_findObj(n, d) { //v4.01 var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); if(!x && d.getElementById) x=d.getElementById(n); return x; }
function MM_swapImage() { //v3.0 var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3) if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];} } //--> </script>
</html>
Darryl Schneider
2,628 PointsAshley,
Posting the code again in this format.
Darryl
<?php
// CREATE LIST $list = array ( $FirstName = $_POST[FirstName], $LastName= $_POST[LastName], $Manager = $_POST[Manager], $Type = $_POST[Type], $DatesRequested= $_POST[DatesRequested], $HoursRequested= $_POST[HoursRequested], $HoursApproved= $_POST[HoursApproved], $HoursAvailable= $_POST[HoursAvailable], $Notes= $_POST[Notes] );
// ADD REQUEST DATE $list[] = date('c');
// WRITE TO CSV FILE $fp = fopen('/home/kozel/public_html/employees/timeoff_requests.csv', 'a+');
fputcsv($fp, $list);
fclose($fp);
$Msg = "Employee Time Off Request
Name: $FirstName $LastName Manager: $Manager Request type: $Type Dates Requested: $DatesRequested Hours Requested: $HoursRequested Hours Currently Approved: $HoursApproved Hours Available: $HoursAvailable Notes: $Notes
Click the following link to download a spreadsheet containing all timeoff requests: http://www.kozelsteel.com/employees/timeoff_requests.csv
";
$recipient = "bmitch@thetoolranch.com" . "," . "$Manager";
mail("$recipient", "Website Time Off Request", $Msg, "From: info@kozelsteel.com\nReply-To: bmitch@thetoolranch.com\nX-Mailer: PHP/" . phpversion());
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Kozel Steel, Rochester NY</title> <link href="../code/kozel.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="../code/swfobject.js"></script> </head>
<body> <H1 style="margin-bottom: 0">Beams - Columns - Structural Steel - Fabrication & Erection - Roof Deck - Reinforcing Steel - Wire Mesh</H1> <p style="margin-top: 0; margin-bottom: 0;"> </p> <div id="container"> <div id="masthead"><img src="../images/kozel-steel.jpg" alt="" width="1000" height="150" border="0" usemap="#Map" /> <map name="Map" id="Map"> <area shape="rect" coords="736,128,990,144" href="mailto:info@kozelsteel.com" alt="Email Us" /> </map> </div> <div class = "line15"> <p style="margin-top: 0; margin-bottom: 0;"> </p> <div class = "lefty"> <ul class="lefty" style="margin-bottom: 0">
<li><a href="../index.html"><img src= "../images/m1.gif" alt="Home" border="0"/></a></li>
<li><img src="../images/mspace.gif" /></li>
<li><a href="../company-history.html"><img src= "../images/m2.gif" alt="Company History" border="0"/></a></li>
<li><img src="../images/mspace.gif" /></li>
<li><a href="../products-services.html"><img src= "../images/m3.gif" alt="Products & Services" border="0"/></a></li>
<li><img src="../images/mspace.gif" /></li>
<li><a href="../request-quote.html"><img src= "../images/m4.gif" alt="Request Quote" border="0"/></a></li>
<li><img src="../images/mspace.gif" /></li>
<li><a href="../our-employees.html"><img src= "../images/m5.gif" alt="Our Employees" border="0"/></a></li>
<li><img src="../images/mspace.gif" /></li>
<li><a href="../downloads.html"><img src= "../images/m6.gif" alt="Downloads" border="0"/></a></li>
<li><img src="../images/mspace.gif" /></li>
<li><a href="../kozeldirect"><img src= "../images/m7.gif" alt="Online Store" border="0"/></a></li>
</ul>
</div>
</div>
<div class = "line2"> </div>
<div id="contentTopper"> </div>
<div id="contentWrapper">
<p style="margin-top: 0; margin-bottom: 0;"> </p>
<div id="content">
<h2>Thank you for your request!</h2>
<p style="margin-bottom: 0;">We will process your time off request. You will be advised regarding your request. If you have any questions in the meantime, contact the office at 585.436.9807.</p>
</div>
<p style="margin-top: 0; margin-bottom: 0;"> </p>
<div id="sidebar">
<h3> </h3>
<p> </p>
<p> </p>
</div> </div> <div id="contentFooter"> </div> <div id="pageFooter"> <a href="../employees"><img src= "../images/m8.gif" alt="Employee Login" border="0"/></a></div> </div> </body> <script type="text/JavaScript"> <!-- function MM_preloadImages() { //v3.0 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++) if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}} }
function MM_swapImgRestore() { //v3.0 var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc; }
function MM_findObj(n, d) { //v4.01 var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); if(!x && d.getElementById) x=d.getElementById(n); return x; }
function MM_swapImage() { //v3.0 var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3) if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];} } //--> </script>
</html>
Codin - Codesmite
8,600 PointsCodin - Codesmite
8,600 PointsYour going to need to show us your code for your timeoff_thanks.php file.
I'm guessing without seeing the code you just need to add a function to get the POST data for the manager from the form and just add his email to the recipients of the script in your action file, or you have this already and there is a mistake in the code.