Probleme en php
Hacker#1
Messages postés
88
Statut
Membre
-
Utilisateur anonyme -
Utilisateur anonyme -
Bonjour,
Quand je clique sur le bouton envoyer dans la page modifier nbre.php j'ai le message suivant
modifier nbre.php
modifierlivre.php
Quand je clique sur le bouton envoyer dans la page modifier nbre.php j'ai le message suivant
Notice: Undefined index: n in C:\wamp\www\compte\modifier nbre.php on line 21
modifier nbre.php
<html>
<style type="text/css">
<!--
.style1 {font-family: Arial}
-->
</style>
<body>
<form action="modifier nbre.php" method="post">
<table width="348" border="0" cellpadding="3">
<tr>
<td width="167"><span class="style1">Nombre d'exemplaire</span></td>
<td width="163"><input type="text" name="nbre"></td>
</tr>
</table>
<input type="submit" name="sub" value="envoyer">
</label>
</p>
</form>
<?php
if(isset($_POST["sub"]))
{$a=$_GET["n"];
$d=$_POST["nbre"];
$base=mysql_connect('localhost','root','');
mysql_select_db('compte');
mysql_query("update livre set `nbre d exemplaire`='$d' where nom='$a'");
}
?>
</body>
</html>
modifierlivre.php
<html>
<style type="text/css">
<!--
.style1 {font-family: Arial}
-->
</style>
<body>
<p>
<a href="frame.php" class="style1">Retour</a>
<p>
<?php
$base=mysql_connect('localhost','root','');
mysql_select_db('compte');
$sql='SELECT * FROM livre';
$req=mysql_query($sql) or die('Erreur SQL!<br>'.$sql.'<br>'.mysql_error());
echo "<table border='0' cellpadding='3' width='507' align='center'>
<tr>
<th><span class='style1'>Nom</span></th>
<th><span class='style1'>Auteur</span></th>
<th><span class='style1'>Editeur</span></th>
<th><span class='style1'>Nbre exemplaire</span></th>
<th><span class='style1'>Image</span></th>
<th></th></tr>
<tr>";
while($data=mysql_fetch_array($req))
{$a=$data["nom"];
$b=$data["auteur"];
$c=$data["maison d edition"];
echo "
<td><span class='style1'>".$data['nom']."</span></td>
<td><span class='style1'>".$data['auteur']."</span></td>
<td><span class='style1'>".$data['maison d edition']."</span></td>
<td><span class='style1'>".$data['nbre d exemplaire']."<br>
<a href='modifier nbre.php?n=$a'>Modifier</a></span></td>
<td><span class='style1'><img src=".$data['img']." width='75' height='115'/>
<br><a href='modifier img.php?name=$a&&writer=$b&&editor=$c'>Modifier</a></span></td>
<td><span class='style1'><a href='#'>Supprimer</a></span></td>
</tr>";
}
echo"</table>";
mysql_free_result($req);
mysql_close();
?>
<p> </p>
</body>
</html>
4 réponses
-
Bsr
<?php
if(isset($_POST["sub"]))
{$a=$_GET["n"]; <-- Ici $_GET["n"] n'est pas défini ! Ta variable "n" n'existe pas
$d=$_POST["nbre"];
-
-
-
Bonsoir,
il y a un problème car les noms de de tes fichiers ou de tes variables (modifier nbre.php et nbre d exemplaire) comporte un espace : il faut éviter de créer des fichiers ou des variables de cette manière .