function saveSpreadSheetToPDF() { $data = createOverviewTable(); $myfile = fopen("Spreadsheet.html", "w") or die("Unable to open file!"); fwrite($myfile, $data); fclose($myfile); }
function showSpreadsheet() { echo createOverviewTable(); }
if (isset($_POST['maxCount'])) { $maxCount = $_POST['maxCount']; for ($i = 0; $i < $maxCount; $i++) { $hidden = "candidateID" . $i; $candidateID = $_POST[$hidden]; $votes = $_POST[$candidateID]; saveElectionResults($_POST['district'], $_POST['machine'], $candidateID, $votes); } } if ($_POST['output'] == " Download CSV ") { $filename = "electionResults.csv"; header('Content-type: application/csv'); header('Content-Disposition: attachment; filename=' . $filename); $date = date("m_d_Y"); echo download('csv', $date); } if ($_POST['output'] == " Download Json ") { $filename = "electionResults.json"; header('Content-type: application/json'); header('Content-Disposition: attachment; filename=' . $filename); $date = date("m_d_Y"); echo download('json', $date); } if ($_POST['output'] == " Get Spreadsheet ") { $filename = date("m_d_Y_") . "electionResults.html"; header('Content-type: application/html'); header('Content-Disposition: attachment; filename=' . $filename); echo "<html><style>\n .overviewOuter{\n border: 1px solid gray;\n border-collapse: collapse;\n text-align: center;\n }\n .overviewNoWrap{\n border: 1px solid gray;\n border-collapse: collapse;\n white-space: nowrap;\n text-align: left;\n color: Black;\n font-weight: bold;\n padding-left: 3px;\n padding-right: 3px;\n min-width: 200px;\n }\n .overviewNoWrapRight{\n border: 1px solid gray;\n border-collapse: collapse;\n white-space: nowrap;\n text-align: right;\n color: black;\n padding-left: 3px;\n padding-right: 3px;\n min-width: 200px;\n }\n .overview{\n border: 1px solid gray;\n border-collapse: collapse;\n text-align: center;\n padding: 4px;\n color:black;\n font-size:14px;\n font-weight: lighter;\n }\n .tally{\n border: 1px solid gray;\n border-collapse: collapse;\n text-align: center;\n padding:3px;\n color:DarkBlue;\n font-size:16px;\n }</style><body>"; echo createOverviewTable(); echo "</body></html>"; }