function insert() { echo "<form action='form.html' method='post'>"; $id = $_POST["Id"]; $firstName = $_POST["FirstName"]; $lastName = $_POST["LastName"]; $title = $_POST["Title"]; $hireDate = $_POST["HireDate"]; $sql = "INSERT INTO employee_info\n\t\t\tVALUES (:id, :firstName, :lastName, :title, :hireDate)"; $array = array(':id' => $id, ':firstName' => $firstName, ':lastName' => $lastName, ':title' => $title, ':hireDate' => $hireDate); if (!empty(SQLUtil::run($sql, $array, true))) { echo "\n - Insert Successful"; } else { echo "\n - Insert Failed"; } echo "<tr>\n\t\t <td width='100'> </td>\n\t\t <td>\n\t \t\t<input name='back' type='submit' id='back' value='Back'>\n\t\t </td>\n\t\t </tr>\n\t </form>"; }
function update() { echo "<form action='form.html' method='post'>"; $id = $_POST["Id"]; $firstName = $_POST["FirstName"]; $lastName = $_POST["LastName"]; $title = $_POST["Title"]; $hireDate = $_POST["HireDate"]; $sql = "UPDATE employee_info\n\t\t\tSET FirstName = :firstName, LastName = :lastName, Title = :title, HireDate = :hireDate\n\t\t\tWHERE Id = :id"; $array = array(':firstName' => $firstName, ':lastName' => $lastName, ':title' => $title, ':hireDate' => $hireDate, ':id' => $id); if (!empty(SQLUtil::run($sql, $array, true))) { echo "\n - Update Successful"; } else { echo "\n - Update Failed"; } echo "<tr>\n\t\t <td width='100'> </td>\n\t\t <td>\n\t \t\t<input name='back' type='submit' id='back' value='Back'>\n\t\t </td>\n\t\t </tr>\n\t </form>"; }