Guillemets qui disparaissent
Bonjour,
J ai deux fichiers php un qui m affiche un tableau avec les entrées de ma base avec une option pour modifier cette entrée et un autre qui affiche la ligne choisie et qui me permet de modifier cette ligne le problème est que quand je clique sur modifier sur l autre page il m enlève les guillemets les 7" devient 7 je sais qu il faut mettre un \ devant mes guillemets ou utiliser addslahes mais je ne sais pas ou ... j ai essayé avec htmlspecialschar mais ca ne marche pas
pouvez-vous m aider
Code:
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 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153
| <?php
include ('config.php');
include ('connexion.php');
if (isset($_POST['btOk']))
{
$sql2= "UPDATE contenu SET reference='".$_POST['reference']."', artiste='".$_POST
['artiste']."',album='".$_POST
['album']."',format='".$_POST['format']."'
WHERE id='".$_POST['id']."'" ;
$req2= mysql_query($sql2) or die('Erreur SQL !'.$sql2.'<br>'.mysql_error());
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Catalogue</title>
<link rel="stylesheet" type="text/css" href="style-cat.css">
</head>
<body link="#000000" vlink="#555555" alink="#dddddd">
<div id="body">
<div id="menu-container"><b>
<a href="label.php?lettre=[0-9]" class="active"><span class="text">0-9</span></a> |
<a href="label.php?lettre=A" target="_self"><span class="text">A</span></a> |
<a href="label.php?lettre=B" target="_self"><span class="text">B</span></a> |
<a href="label.php?lettre=C" target="_self"><span class="text">C</span></a> |
<a href="label.php?lettre=D" target="_self"><span class="text">D</span></a> |
<a href="label.php?lettre=E" target="_self"><span class="text">E</span></a> |
<a href="label.php?lettre=F" target="_self"><span class="text">F</span></a> |
<a href="label.php?lettre=G" target="_self"><span class="text">G</span></a> |
<a href="label.php?lettre=H" target="_self"><span class="text">H</span></a> |
<a href="label.php?lettre=I" target="_self"><span class="text">I</span></a> |
<a href="label.php?lettre=J" target="_self"><span class="text">J</span></a> |
<a href="label.php?lettre=K" target="_self"><span class="text">K</span></a> |
<a href="label.php?lettre=L" target="_self"><span class="text">L</span></a> |
<a href="label.php?lettre=M" target="_self"><span class="text">M</span></a> |
<a href="label.php?lettre=N" target="_self"><span class="text">N</span></a> |
<a href="label.php?lettre=O" target="_self"><span class="text">O</span></a> |
<a href="label.php?lettre=P" target="_self"><span class="text">P</span></a> |
<a href="label.php?lettre=Q" target="_self"><span class="text">Q</span></a> |
<a href="label.php?lettre=R" target="_self"><span class="text">R</span></a> |
<a href="label.php?lettre=S" target="_self"><span class="text">S</span></a> |
<a href="label.php?lettre=T" target="_self"><span class="text">T</span></a> |
<a href="label.php?lettre=U" target="_self"><span class="text">U</span></a> |
<a href="label.php?lettre=V" target="_self"><span class="text">V</span></a> |
<a href="label.php?lettre=W" target="_self"><span class="text">W</span></a> |
<a href="label.php?lettre=X" target="_self"><span class="text">X</span></a> |
<a href="label.php?lettre=Y" target="_self"><span class="text">Y</span></a> |
<a href="label.php?lettre=Z" target="_self"><span class="text">Z</span></a></b>
</div>
<?php
include ('config.php');
include ('connexion.php');
$new = htmlspecialchars('<td><a href="m.php?id='.$resultat['id'].'">Modifier</a></td>';, ENT_QUOTES);
if(isset($req2))
{
echo ("L'insertion a été correctement effectuée") ;
echo '<br><a href="http://arm-
info.hd.free.fr/handsandarms/label_modif.php">Retour sur les labels</a></br>';
}
echo '<table>
<tr>
<th>id</th>
<th>Label</th>
<th>Référence</th>
<th>Artiste</th>
<th>Album</th>
<th>Format</th>
<th>Modifier</th>
</tr>';
// paramètre reçu désignant le critère du nom du label recherché
$param1 = mysql_real_escape_string($_GET['lettre']);
//
$sql = "SELECT * FROM label
INNER JOIN contenu ON contenu.id_label = label.id_label
Where nom_label REGEXP '^$param1' order by nom_label, reference;
";
$req = mysql_query($sql);
while ($resultat = mysql_fetch_array($req))
{
echo '<tr>';
echo '<td>'.$resultat['id'].'</td>';
echo '<td>'.$resultat['nom_label'].'</td>';
echo '<td>'.$resultat['reference'].'</td>';
echo '<td>'.$resultat['artiste'].'</td>';
echo '<td>'.$resultat['album'].'</td>';
echo '<td>'.$resultat['format'].'</td>';
echo $new;
echo '</tr>';
}
echo '</table>';
$var = $resultat;
if($var == null){
echo "Aucune référence trouvée";
}
?>
</body></html>
<?php
mysql_close();
?> ] |
le deuxieme fichier php
Code:
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 72 73 74 75
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Catalogue</title>
<link rel="stylesheet" type="text/css" href="style-cat.css">
</head>
<body link="#000000" vlink="#444444" alink="#888888">
<div id="body">
<?php
include ('config.php');
include ('connexion.php');
$id = $_GET["id"];
$sql = "SELECT id, reference, artiste, album, format FROM contenu WHERE id='".$_GET
['id']."'" ;
$req = mysql_query($sql) or die( mysql_error() ) ;
$total = mysql_num_rows($req);
{
echo '<form method ="post" action="lm.php">';
echo '<table>'."\n";
echo '<tr>';
echo '<td ><b><u>id</u></b></td>';
echo '<td ><b><u>reference</u></b></td>';
echo '<td><b><u>artiste</u></b></td>';
echo '<td><b><u>album</u></b></td>';
echo '<td><b><u>format</u></b></td>';
echo '</tr>'."\n";
while($row = mysql_fetch_array($req))
{
echo '<tr>';
echo '<td>'.$id.'</td>';
echo '<td><input type="text" name="reference" value="'.$row
["reference"].'"/></td>';
echo '<td><input type="text" name="artiste" value="'.$row["artiste"].'"/></td>';
echo '<td><input type="text" name="album" value="'.$row["album"].'"/></td>';
echo '<td><input type="text" name="format" value="'.$row["format"].'\"/></td>';
echo '</tr>'."\n";
}
echo '</table>'."\n";
echo '<input type="hidden" name="id" value="'.$_GET['id'].'" /><input
type="submit" name="btOk" value="Modifier"/>';
echo '</form>';
}
?>
</body></html>
<?php
mysql_close();
?> |