如何在table column($row['survey_name'])
超链接中插入值。这是我在php中试过的代码:
while($row=mysql_fetch_array($result1))
{
$content .= "
<tr id=\"special\" style=\"background:;\">
<td>". $row['survey_name'] . "</td>
<td>" . $row['date'] . "</td>
</tr>
";
?>
<script
$('#special').onclick(function(){window="http://urllinkto.com/x/y/z";})
</script>
<?php }//end of while
if ($content) {
// See note on the "quote switch" here
echo '
<table border= "5" cellpadding="2" cellspacing="2" width="100%">
<tr>
<td><strong>Survey Name</strong></td>
<td><strong>Date Created</strong></td>
/tr>' .
$content . '
</table> ';
答案 0 :(得分:2)
恰克
<td>". $row['survey_name'] . "</td>
为:
<td><a href='URL HERE'>". $row['survey_name'] . "</a></td>
答案 1 :(得分:1)
尝试先声明变量。
while($row=mysql_fetch_array($result1)){
$surveyname = $row['survey_name']
$date = $row['date']
$content .= "
<tr id=\'special\' style=\"background:;\">
<td><a href='#'>echo $surveyname</a> </td>
<td><a href='#'>echo $date</a></td>
</tr>
";
}