Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
DatabasesPhase2_GroupE/adminPages/AddEmployee.php
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
108 lines (83 sloc)
4.75 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require("../dbCon.php"); | |
require("../commonFunctions.php"); | |
if (isset($_GET['LastName'])){ | |
$query = "INSERT INTO employees (password, LastName, FirstName, Title, TitleOfCourtesy, | |
BirthDate, HireDate, Address, City, Region, | |
PostalCode, Country, HomePhone, Extension, Notes, | |
ReportsTo, Salary) | |
VALUES(?,?,?,?,?, | |
?,?,?,?,?, | |
?,?,?,?,?, | |
?,?)"; | |
$stmt = $con->prepare($query); | |
$stmt ->bind_param("sssssssssssssssdd", $_GET['Password'], $_GET['LastName'], $_GET['FirstName'], $_GET['Title'], $_GET['TitleOfCourtesy'], | |
$_GET['BirthDate'], $_GET['HireDate'], $_GET['Address'], $_GET['City'], $_GET['Region'], | |
$_GET['PostalCode'], $_GET['Country'], $_GET['HomePhone'], $_GET['Extension'], $_GET['Notes'], | |
$_GET['ReportsTo'], $_GET['Salary']); | |
$stmt ->execute(); | |
} | |
?> | |
<html> | |
<head> | |
<link rel="stylesheet" href="../style.css"> | |
</head> | |
<body> | |
<div id="header"> | |
<?php writeMenuAdm('Employees.php'); ?> | |
</div> | |
<div id='contentwrapper'> | |
<form action = "AddEmployee.php" method = "get"> | |
<h1>Add Employee</h1> | |
<div class="form-group"> | |
<label>Password</label> | |
<input type="text" name="Password" id="Password" required> | |
<label>Last Name</label> | |
<input type="text" name="LastName" id="LastName" required> | |
<label>First Name</label> | |
<input type="text" name="FirstName" id="FirstName" required> | |
<label>Title</label> | |
<input type="text" name="Title" id="Title" required> | |
<label>Title Of Courtesy</label> | |
<input type="text" name="TitleOfCourtesy" id="TitleOfCourtesy" required> | |
<label>Birth Date (yyyy-mm-dd)</label> | |
<input type="text" name="BirthDate" id="BirthDate" required> | |
<label>Hire Date (yyyy-mm-dd)</label> | |
<input type="text" name="HireDate" id="HireDate" required> | |
<label>Address</label> | |
<input type="text" name="Address" id="Address" required> | |
<label>City</label> | |
<input type="text" name="City" id="City" required> | |
<label>Region</label> | |
<input type="text" name="Region" id="Region" required> | |
<label>Postal Code</label> | |
<input type="text" name="PostalCode" id="PostalCode" required> | |
<label>Country</label> | |
<input type="text" name="Country" id="Country" required> | |
<label>Home Phone Number</label> | |
<input type="text" name="HomePhone" id="HomePhone" required> | |
<label>Extension</label> | |
<input type="text" name="Extension" id="Extension" required> | |
<label>Notes</label> | |
<input type="text" name="Notes" id="Notes" required> | |
<label>Reports To</label> | |
<select name="ReportsTo" id="ReportsTo"> | |
<?php | |
echo "<option value='null'></option>"; | |
$query ="SELECT * FROM employees"; | |
$stmt = $con->prepare($query); | |
$stmt ->execute(); | |
$result = $stmt->get_result(); | |
while($row = mysqli_fetch_array($result)){ | |
echo "<option value='" . $row['EmployeeID'] . "'>" . $row['FirstName'] . " " . $row['LastName'] . "</option>"; | |
} | |
?> | |
</select> | |
<label>Salary</label> | |
<input type="text" name="Salary" id="Salary" required> | |
<input type="submit" value="Add Employee"> | |
</div> | |
</form> | |
</div> | |
</body> | |
</html> |