$values['family'] = $_POST['family']; $values['winning'] = $_POST['winning']; $values['overall_performance'] = $_POST['overall_performance']; $check = ''; if (!empty($_POST['moving_around'])) { foreach ($_POST['moving_around'] as $chk) { $check .= "<p>" . $chk . "</p>"; } } $values['moving_around'] = $check; $values['nextachievements'] = $_POST['nextachievements']; $values['managerscomments'] = $_POST['managerscomments']; $values['mycomments'] = $_POST['mycomments']; include_once 'spreadsheet.php'; $doc = new spreadsheet(); $auth = $doc->authenticate("*****@*****.**", "4UuDwQFR "); $setspreadsheet = $doc->setSpreadsheet("PizzaExpressAppraisal-OperationsManager"); $setworksheet = $doc->setWorksheet("Sheet1"); $add = $doc->add($values); var_dump($auth, $setspreadsheet, $setworksheet, $add); $admin_email = $_POST['email']; $noreply = "*****@*****.**"; $subject = "RESULTS - PIZZA EXPRESS APPRAISAL"; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $summary = file_get_contents('email.html'); foreach ($values as $key => $value) { $summary = str_replace("{" . $key . "}", $value, $summary); } //if "email" variable is filled out, send email if (isset($_POST['email'])) {
// set the SMTP port for the GMAIL server $mail->Username = "******"; // SMTP account username $mail->Password = "******"; // SMTP account password $mail->AddReplyTo('*****@*****.**', 'Michael Cox'); $mail->AddAddress('*****@*****.**', 'Michael Cox'); $mail->AddAddress('*****@*****.**', 'Umberto Garozzo'); $mail->SetFrom('*****@*****.**', 'Blackbridge'); $mail->AddReplyTo('*****@*****.**', 'Blackbridge'); $mail->Subject = 'Blackbridge feedback'; $mail->MsgHTML($message); $mail->Send(); //echo "Message Sent OK</p>\n"; } catch (phpmailerException $e) { //echo $e->errorMessage(); //Pretty error messages from PHPMailer } catch (Exception $e) { //echo $e->getMessage(); //Boring error messages from anything else! } header("Location: ../stage-7-final"); } else { if ($_GET['go'] == 'thankyou') { $doc = new spreadsheet(); $doc->authenticate("*****@*****.**", "blacksem1234"); $doc->setSpreadsheet("Feedback"); $doc->setWorksheet("Charity"); $data = array('client' => $_SESSION['client'], 'project' => $_SESSION['project'], 'person' => $_SESSION['person'], 'charity' => $_SESSION['charity']); $doc->add($data); header("Location: ../thank-you"); } }