Skip to content
Permalink
ae335aeb5c
Switch branches/tags

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?
Go to file
 
 
Cannot retrieve contributors at this time
108 lines (83 sloc) 4.75 KB
<?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>