我想在php表中添加一个url和变量。
请任何人帮我解决这个问题。
有关详细信息,请参阅表格中的评论说明。
<?php
include('config.php');
$qry = "SELECT * FROM pincode_data where pinCode='641028'";
$result = mysql_query($qry) or die (mysql_error());
echo '<table cellpadding="0" cellspacing="0" class="db-table">';
while($row=mysql_fetch_array($result))
{
echo "<tr><td>Pincode:</td> <td><a href='pinview.php?pin=" . $pinCode . "'>".$row['pinCode'] . "</td></tr>"; //I want a hyperlink here along with pin number example url: pinview.php?pin=641028
echo "<tr><td>Office Name:</td> <td>" . $row['postOffice'] . "</a></td>";
echo "<tr><td>Office Type:</td> <td>".$row['OfficeType'] . " </td></tr>";
echo "<tr><td>Contact:</td> <td>".$row['contact'] . "</td></tr>";
echo "<tr><td>Taluk:</td> <td>".$row['talukName'] . " </td></tr>";
echo "<tr><td>District:</td> <td>".$row['districtName'] . " </td></tr>";
echo "<tr><td>State:</td> <td>".$row['stateName'] . "</td></tr>";
echo "<tr><td>Postal Division:</td> <td>".$row['postalDivision'] . " </td></tr>";
echo "<tr><td>Postal Region:</td> <td>".$row['postalRegion'] . " </td></tr>";
echo "<td>Postal Circle:</td> <td>".$row['postalCircle'] . "</td> ";
}
echo "</table>";
mysql_close();
?>
答案 0 :(得分:0)
替换为此行,您必须添加$row['pinCode']
而不是$pinCode
echo "<tr><td>Pincode:</td> <td><a href='pinview.php?pin=" . $row['pinCode'] . "'>".$row['pinCode'] . "</td></tr>";