A
Anonymous
Guest
I am attaching my configuration files to you.
index.emprunt.php
<html>
<div class="form-group">
<label id="senderName">Etudiants</label>
<select name="etudiant">;
<?php
$con = mysqli_connect("localhost","fred","poseidon","class");
$sql = mysqli_query($con,"SELECT * from etudiants");
$row = mysqli_num_rows($sql);
while ($row = mysqli_fetch_array($sql)){
echo "<option value='". $row['Nom'] ."'>" .$row['Nom'] ."</option>";
echo "<option value='". $row['IdClient'] ."'>" .$row['IdClient'] ."</option>";
}
?>
</select>
</div>
</html>
<div class="form-group">
<label id="senderName">Titre</label>
<select name="Titre">;
<?php
$con = mysqli_connect("localhost","fred","poseidon","class");
$sql = mysqli_query($con,"SELECT * From livres");
$row = mysqli_num_rows($sql);
while ($row = mysqli_fetch_array($sql)){
echo "<option value='". $row['RefLivre'] ."'>" .$row['RefLivre'] ."</option>" ;
echo "<option value='". $row['Titre'] ."'>" .$row['Titre'] ."</option>" ;
}
?>
</select>
</div>
<form method="POST" action="emprunt.php">
<div class="form-group">
<label id="senderName">RefLivre</label>
<select name="RefLivre">;
<?php
$con = mysqli_connect("localhost","fred","poseidon","class");
$sql = mysqli_query($con,"SELECT RefLivre From livres");
$row = mysqli_num_rows($sql);
while ($row = mysqli_fetch_array($sql)){
echo "<option value='". $row['reflivre'] ."'>" .$row['RefLivre'] ."</option>";
}
?>
</select>
</div>
<div class="form-group">
<label id="senderName">IdClient</label>
<select name="IdClient">;
<?php
$con = mysqli_connect("localhost","fred","poseidon","class");
$sql = mysqli_query($con,"SELECT IdClient From etudiants");
$row = mysqli_num_rows($sql);
while ($row = mysqli_fetch_array($sql)){
echo "<option value='". $row['IdClient'] ."'>" .$row['IdClient'] ."</option>";
}
?>
</select>
</div>
<div class="form-group">
<label for="dateSortie">Date Sortie</label><br>
<input type="date" name="date_sortie" id="date_Sortie" class="form-control date";
</div>
<div class="form-group">
<label for="dateRendu">Date Rendu</label><br>
</div>
<div align="center">
<td align="center"><input class="btn" type=submit name="Valider" value="OK"></td>
</div>
</form>
</table>
</form>
</body>
</html>
<?php
$conn=mysqli_connect("localhost","fred","poseidon","class") or die(mysqli_error());
$RefLivre=$_POST['RefLivre'];
$IdClient=$_POST['IdClient'];
$date_sortie=$_POST['date_sortie'];
$date_rendu=$_POST['date_rendu'];
$req="INSERT INTO emprunt (RefLivre,IdClient,date_sortie,date_rendu) VALUES ('$RefLivre','$IdClient','$date_sortie',$date_rendu')";
$res=mysqli_query($conn,$req);
?>
<!DOCTYPE html>
<html>
<body>
<!DOCTYPE html>
<html>
<body>
<form>
<div align=”center”><h3>l’emprunt</h2>
<table align=”center”»>
<tr>
</tr>
</table>
<p>est bien enregister </p>
<p><a href="index.emprunt.php">ajouter un nouvel EMPRUNT</a></p> </div>
<p><a href="index.html">RETOUR A L'ACCEUIL </a></p> </div>
</form>
</body>
</html>
fichier emprunt.php
index.emprunt.php
<html>
<div class="form-group">
<label id="senderName">Etudiants</label>
<select name="etudiant">;
<?php
$con = mysqli_connect("localhost","fred","poseidon","class");
$sql = mysqli_query($con,"SELECT * from etudiants");
$row = mysqli_num_rows($sql);
while ($row = mysqli_fetch_array($sql)){
echo "<option value='". $row['Nom'] ."'>" .$row['Nom'] ."</option>";
echo "<option value='". $row['IdClient'] ."'>" .$row['IdClient'] ."</option>";
}
?>
</select>
</div>
</html>
<div class="form-group">
<label id="senderName">Titre</label>
<select name="Titre">;
<?php
$con = mysqli_connect("localhost","fred","poseidon","class");
$sql = mysqli_query($con,"SELECT * From livres");
$row = mysqli_num_rows($sql);
while ($row = mysqli_fetch_array($sql)){
echo "<option value='". $row['RefLivre'] ."'>" .$row['RefLivre'] ."</option>" ;
echo "<option value='". $row['Titre'] ."'>" .$row['Titre'] ."</option>" ;
}
?>
</select>
</div>
<form method="POST" action="emprunt.php">
<div class="form-group">
<label id="senderName">RefLivre</label>
<select name="RefLivre">;
<?php
$con = mysqli_connect("localhost","fred","poseidon","class");
$sql = mysqli_query($con,"SELECT RefLivre From livres");
$row = mysqli_num_rows($sql);
while ($row = mysqli_fetch_array($sql)){
echo "<option value='". $row['reflivre'] ."'>" .$row['RefLivre'] ."</option>";
}
?>
</select>
</div>
<div class="form-group">
<label id="senderName">IdClient</label>
<select name="IdClient">;
<?php
$con = mysqli_connect("localhost","fred","poseidon","class");
$sql = mysqli_query($con,"SELECT IdClient From etudiants");
$row = mysqli_num_rows($sql);
while ($row = mysqli_fetch_array($sql)){
echo "<option value='". $row['IdClient'] ."'>" .$row['IdClient'] ."</option>";
}
?>
</select>
</div>
<div class="form-group">
<label for="dateSortie">Date Sortie</label><br>
<input type="date" name="date_sortie" id="date_Sortie" class="form-control date";
</div>
<div class="form-group">
<label for="dateRendu">Date Rendu</label><br>
</div>
<div align="center">
<td align="center"><input class="btn" type=submit name="Valider" value="OK"></td>
</div>
</form>
</table>
</form>
</body>
</html>
<?php
$conn=mysqli_connect("localhost","fred","poseidon","class") or die(mysqli_error());
$RefLivre=$_POST['RefLivre'];
$IdClient=$_POST['IdClient'];
$date_sortie=$_POST['date_sortie'];
$date_rendu=$_POST['date_rendu'];
$req="INSERT INTO emprunt (RefLivre,IdClient,date_sortie,date_rendu) VALUES ('$RefLivre','$IdClient','$date_sortie',$date_rendu')";
$res=mysqli_query($conn,$req);
?>
<!DOCTYPE html>
<html>
<body>
<!DOCTYPE html>
<html>
<body>
<form>
<div align=”center”><h3>l’emprunt</h2>
<table align=”center”»>
<tr>
</tr>
</table>
<p>est bien enregister </p>
<p><a href="index.emprunt.php">ajouter un nouvel EMPRUNT</a></p> </div>
<p><a href="index.html">RETOUR A L'ACCEUIL </a></p> </div>
</form>
</body>
</html>
fichier emprunt.php