1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
|
<?php
$message = '';
$db = new mysqli('localhost', 'root', '', 'profile');
if ($db->connect_error) {
$message = $db->connect_error;
} else {
$sql = 'SELECT * FROM heb ORDER BY `id` ASC ';
$result = $db->query($sql);
if ($db->error) {
$message = $db->error;
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>HEA</title>
<link rel="stylesheet" type="text/css" href="./css/profile.css">
</head>
<body>
<div id="bigbox">
<form method="post">
<?php
if($message){
echo "$message";
}
echo "<select name='sub1'>";
while ($row = $result -> fetch_assoc()) {
echo "<option value='" . $row['nom'] . "'>" . $row['nom'] . "</option>";
}
echo "</select>";
?>
<input type="submit" name="afficher" value="Afficher">
<?php
if (isset($_POST['sub1'])) {
$query = "SELECT * FROM heb WHERE nom = ?";
$stmt = $db->prepare($query);
$stmt->bind_param('s', $_POST['sub1']);
$exec = $stmt->execute();
if ($exec) {
$result = $stmt->get_result();
$data = $result->fetch_assoc();
}
echo '<p class="nom">' . $data['nom'] . "</p>";
echo '<p class="hauteur">' . $data['hauteur'] . "</p>";
echo '<p class="base">' . $data['base'] . "</p>";
echo '<p class="tw">' . $data['tw'] . "</p>";
echo '<p class="tf">' . $data['tf'] . "</p>";
echo '<p class="rayon">' . "R" . $data['rayon'] . "</p>";
echo '<p class="poids">' . "Poids(kg/m) = " . $data['poids'] . "</p>";
echo '<p class="diametre">' . "Diamettre = ". $data['diametre'] . "</p>";
echo '<p class="air">' . "Air section = ". $data['air'] . "</p>";
}
?>
</form>
</div>
</body>
</html> |
Partager