我正在使用以下代码来显示可点击的图片,但在图片下方它显示了图片的描述,在这部分:
<br>".$row['optie'];"
但表格中的某些行太长,无法正确并排显示图片和说明。那么如何显示这些描述并添加换行符?
<?php
$query = "SELECT * FROM $tabel";
$result = mysql_query($query);
$aantal = 0;
echo "<table>";
echo "<tr>";
while( ($row = mysql_fetch_array($result)))
{
$src = $row['afbeelding'];
echo '<div class="Image">';
echo "<td align='center'><h2><a href='pagina3.php?lang=" . $_SESSION['lang'] . "&naam=" . $naam . "&postcodehuisnummer=" .$postcodehuisnummer ."&fietskeuze=" . $fietskeuze . "&opties=" . $row['optie'] . "&optieid=" . $row['opties_id'] . "' '><img src=".$src." width='400px'><br>".$row['optie'];"</a><br /><br /> ";
echo '</div>';
$aantal++;
if ($aantal==3) {echo "<tr>"; $aantal=0;}
}
echo "</tr></tr>";
echo "</table>";
?>