help for information

Codes here !

Moderators: egami, macek, gesf

Post Reply
Nabile
New php-forum User
New php-forum User
Posts: 3
Joined: Mon Aug 10, 2020 11:35 pm

Mon Aug 10, 2020 11:44 pm

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
Nabile
New php-forum User
New php-forum User
Posts: 3
Joined: Mon Aug 10, 2020 11:35 pm

Tue Aug 11, 2020 12:10 am

I'm sorry I lost my first explanatory message.
I am in training and I have a project "lamp" carried out.
I chose a simple subject: registering students and books to lend them on the intranet.
my student files and books no worries (I have two index.livre.php and livre.php files as well as index.inscription and inscription.php)
my problem is with the index.emprunt.php and borrowing.php files
with the index.emprunt file I chose with a drop-down menu the students to register and the books as well as the dates.
I have no error messages but when I consult my mariadb table there is nothing.
I am a student in computer systems and networks.

Thanks in advance.
Post Reply