<input class="form-control" id="age" name="age" type="text"/> </div> <div class="propFields"> <label>Должность</label> <input class="form-control" id="post" name="post" type="text"/> </div> <div style="margin: 3px; float: left;"> <label>Отдел</label><br/> <select size="1" name="department" style="height: 34px;" class="form-control"> <option disabled>Выбор отдела</option> <option selected value="Отдел маркетинга">Отдел маркетинга</option> <option value="Отдел поставок">Отдел поставок</option> <option value="Отдел финансов">Отдел финансов</option> <option value="Отдел персонала">Отдел персонала</option> </select> </div> <input class="btn btn-primary" type="submit" style="margin-top: 28px; margin-left: 3px" value="Добавить"/> </div> </form> <?php require 'MyFunctions.php'; @AddEmployee($_POST["name"], $_POST['fname'], $_POST['age'], $_POST['post'], $_POST['department']); @ShowEmployees(); ?> </body> </html>
$number = $_POST['number']; $postalcode = $_POST['postalcode']; $city = $_POST['city']; $hotel_id = $_POST['hotel_id']; $start_date = $_POST['start_date']; $salary = $_POST['salary']; if (isset($_POST['end_date'])) { $end_date = $_POST['end_date']; } else { $end_date = NULL; } if (isset($_POST['phone_number_1'])) { $phone_number_1 = $_POST['phone_number_1']; } else { $phone_number_1 = NULL; } if (isset($_POST['phone_number_2'])) { $phone_number_2 = $_POST['phone_number_2']; } else { $phone_number_2 = NULL; } $exists = EmployeeExists($ssn); if (!$exists) { $employee_id = AddEmployee($ssn, $name, $surname, $street, $number, $postalcode, $city, $hotel_id, $start_date, $end_date, $salary, $phone_number_1, $phone_number_2); header('Location: employees_add.php?success=true'); } else { header('Location: employees_add.php?exists=true'); } } else { header('Location: employees_add.php?missing=true'); }