Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
77 lines (70 sloc) 2.74 KB
// Include the common file containing the database connection
require "common.php";
<!DOCTYPE html>
<html lang="en">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<meta name="description" content="">
<meta name="author" content="">
<title>Cars example - list makes</title>
<!-- Bootstrap -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src=""></script>
<script src=""></script>
function fnConfirmDelete(whichMake)
return confirm("Please confirm you wish to delete this make: " + whichMake + "?")
// Include the header file
require "header.php";
<div class="container" style="margin-top: 60px;">
<h1>Car Makes</h1>
try {
echo "<table class='table'>";
echo "<tr>";
echo "<th>Make</th>";
echo "<td colspan='2'><a href='edit.php?id=0' class='btn btn-default'>Add</a></td>";
echo "</tr>";
foreach ($dbh->query('SELECT * FROM makes ORDER BY make ASC') as $row) {
echo "<tr>";
echo "<td>". $row['make'] ."</td>";
echo "<td><a href='edit.php?id=". $row['id'] ."' class='btn btn-default'>Edit</a></td>";
echo "<td><a onclick='return fnConfirmDelete(\"". $row['make'] ."\");' href='delete.php?id=". $row['id'] ."' class='btn btn-default'>Delete</a></td>";
echo "</tr>";
echo "</table>";
$dbh = null;
} catch (PDOException $e) {
print "Error!: " . $e->getMessage() . "<br/>";
// Include the footer file
require "footer.php";
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src=""></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="js/bootstrap.min.js"></script>
// End of index.php