我在php代码中的html表格上遇到了问题。我尝试了这段代码,但我对标签中的 href 有问题。事实上,当我点击 href 时,它会发布未定义,而 DetailsAnnonces.php 存在。
感谢您的回复。
<?php
$conn=@mysqli_connect($_SESSION['servername'],$_SESSION['username'],
$_SESSION['password'], $_SESSION['database']) or die(mysql_error());
$verifExistence1 = "SELECT * FROM `annonces`;";
$result = mysqli_query($conn, $verifExistence1);
echo "<table border = 2>";
echo "<table align='center'> <thead>
<tr>
<th>Titre</th>
<th>Description</th>
<th>Image</th>
</tr>
</thead>
<tbody>";
while($row = @mysqli_fetch_assoc($result)){
$idbis=$row['id'];
$titrebis=$row['titre'];
echo "<tr>
<td>" . $row['titre'] . "</td><td>" . $row['description'] . "</td>
<td> <a href='"DetailsAnnonces.php?id=$idbis'">$titrebis</a>
</tr>";
}
echo "</table>";
//echo $html_table;
?>
该问题是由此页面上留下的javascript引起的。
问题出在$idbis
<?php
echo "
<td>
<a href='DetailsAnnonces.php?id=".$idbis.">'".$titrebis."</a>
</td>
</tr>";
?>