* Sunda Cyber Army 2k17 *
Indonesia Defacer ~
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Acad276 Practical Exam: Search</title>
<style>
h1 {
margin: auto;
text-align: center;
background-color: #900;
color: #FC0;
// height: 60px;
line-height: 60px;
}
h2 {
margin: auto;
text-align: center;
padding: 30px;
}
.container {
width: 400px;
margin: auto;
border: 1px solid red;
}
.left-col, .right-col {
float: left;
width: 100%;
height: 280px;
border: 1px solid #990000;
}
.label, .input {
float: left;
width: 130px;
margin: 3px;
}
.label {
margin-left: 40px;
}
.input>input, .input>select {
width: 100%;
}
.search-submit {
margin-top: 20px;
margin-left: 170px;
width: 80px;
}
</style>
</head>
<body>
<?php
//CONNECT TO DATABASE
$mysql = new mysqli(
"webdev.iyaclasses.com",
"dent_guest",
"Acad276_Ttrojan_Dev2Ex@m",
"dent_exam"
);
//DATABASE CONNECTION TROUBLESHOOTING
if($mysql->connect_errno){
echo "DATABASE Connection ERROR";
echo $mysql->connect_error;
//connect_error is text error
exit();
};
?>
<div class="container">
<h1>Mobile Devices Database</h1>
<div class="left-col">
<h2>Search the Database</h2>
<form method="get" action="results.php">
<div class="label">Device Name:</div>
<div class="input">
<input type="text" name="device_name"/>
</div>
<br clear="all"/>
<!--MANUFACTURER-->
<?php
$sql1 = "SELECT manufacturer_id, manufacturer
FROM manufacturers";
$results1 = $mysql->query($sql1);
if(!$results1) {
echo "SQL error: ". $mysql->error;
exit();
};
?>
<div class="label">Manufacturer :</div>
<div class="input">
<select name="manufacturer_id">
<option value='all'>All</option>
<?php
while($currentrow1 = $results1->fetch_assoc()) {
echo "<option value='" .
$currentrow1["manufacturer_id"] .
"'>" .
$currentrow1["manufacturer"] .
"</option>";
}
?>
</select>
</div>
<br clear="all"/>
<?php
$sql2 = "SELECT system_id, system
FROM systems";
$results2 = $mysql->query($sql2);
if(!$results2) {
echo "SQL error: ". $mysql->error;
exit();
};
?>
<div class="label">Operating System:</div>
<div class="input">
<select name="system_id">
<option value='all'>All</option>
<?php
while($currentrow2 = $results2->fetch_assoc()) {
echo "<option value='" .
$currentrow2["system_id"] .
"'>" .
$currentrow2["system"] .
"</option>";
}
?>
</select>
</div>
<br clear="all"/>
<?php
$sql3 = "SELECT type_id, type
FROM types";
$results3 = $mysql->query($sql3);
if(!$results3) {
echo "SQL error: ". $mysql->error;
exit();
};
?>
<div class="label">Type:</div>
<div class="input">
<select name="type_id">
<option value='all'>All</option>
<?php
while($currentrow3 = $results3->fetch_assoc()) {
echo "<option value='" .
$currentrow3["type_id"] .
"'>" .
$currentrow3["type"] .
"</option>";
}
?> </select>
</div>
<br clear="all"/>
<input class="search-submit" type="submit" value="Search"/>
</form>
</div>
<br clear="all"/>
</div>
</body>
</html>