tbright Posted July 22, 2008 Share Posted July 22, 2008 I've made a calculator to calculate the overtime owed to an employee and send it to them by email. You can view and test the calculator here. The email sends, but it only has zeros in the calculations? I have no idea what could be wrong. <? $to = "$email" . ", " ; $to .= "[email protected]" . ", "; $subject = "Calculations from" . "californiawagelawyer"; $server_name = "californiawagelawyer"; if (!empty($_POST['send']) || !empty($_GET['send'])) { $action = (!empty($_POST['send'])) ? $_POST['send'] : $_GET['send']; } else { $action = ''; } if($action != "") { $build_message = true; $form_complete= true; $hourly_rate = trim($_POST['hourly_rate']); $uncompensated_hours = trim($_POST['uncompensated_hours']); $meals_missed = trim($_POST['meals_missed']); $look_back_period = trim($_POST['look_back_period']); $email = trim($_POST['email']); $time = time(); $date = date("F j, Y", time()); $headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/plain; charset=UTF-8\r\n"; $headers .= "From: $server_name\r\n"; $headers .= "X-mailer: " . $server_name . " Server\r\n"; } if (isset($_REQUEST['form_complete'])) { $hourly_rate = $_REQUEST['hourly_rate']; $uncompensated_hours = $_REQUEST['uncompensated_hours']; $meals_missed = $_REQUEST['meals_missed']; $look_back_period = $_REQUEST['look_back_period']; $form_complete = $_REQUEST['form_complete']; if ($form_complete) { $hourly_rate = ereg_replace( "[^0-9.]", "", $hourly_rate); $uncompensated_hours = eregi_replace("[^0-9.]", "", $uncompensated_hours); $meals_missed = eregi_replace("[^0-9.]", "", $meals_missed); $look_back_period = eregi_replace("[^0-9.]", "", $look_back_period); } if ($form_complete) { $total_overtime_hours = $uncompensated_hours * $look_back_period; $overtime_hourly_rate = $hourly_rate * 1.5; $overtime_owed = $total_overtime_hours * $overtime_owed; $meals_owed = $look_back_period * $meals_missed * $hourly_rate; $subtotal_owed = $meals_owed + overtime_owed; $estimated_owed_interest = .1283 * $overtime_owed; $equation = $hourly_rate * 160; $calc = $overtime_hourly_rate * 15; $penalties = 1.5 * ($equation * $calc); $grand_total = $subtotal + $estimated_owed_interest + $penalties; } else { $result = "Sorry: An error occured, please try again."; } if($build_message) { $message = "Your overtime rate per hour is $total_overtime_hours dollars. The overtime hours owed to you is $overtime_hourly_rate dollars. Your employer owes you for impared overtime is $overtime_owed. Your employer owes you $meals_owed dollars for missed meal periods.</p> <p>Your owed subtotal is $subtotal_owed dollars. </p> <p>Estimated interest owed is $estimated_owed_interest dollars. Employer penalties added are $penalties dollars. </p> <p>Your employer may owe you $grand_total dollars.</p>"; if(mail($to, $subject, $message, $headers)) { $result = "<b>Thank you</b>.<br />Your calculations have been sent to the provided e-mail address.<br />"; } else { $result = "Sorry: An error occured, please try again."; } } print $result; ?> Link to comment https://forums.phpfreaks.com/topic/115937-emailing-calculations/ Share on other sites More sharing options...
sader Posted July 22, 2008 Share Posted July 22, 2008 I looked at your html code and found that form method=GET it should be POST Link to comment https://forums.phpfreaks.com/topic/115937-emailing-calculations/#findComment-596105 Share on other sites More sharing options...
tbright Posted July 22, 2008 Author Share Posted July 22, 2008 Oh goodness. How simple. Thanks. =) Link to comment https://forums.phpfreaks.com/topic/115937-emailing-calculations/#findComment-596195 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.