我想将带有单元格值的按钮嵌入到以下行 [COL 3],[COL 4],[COL 5]
但是我的代码被下划线为红色,我想知道我做错了什么
这是我的代码:
echo
'<tr><td>'. $row["COL 2"] .
'<td><input type='button' class='buttons' value ='. $row["COL 3"] .
'<td><input type='button' class='buttons' value ='. $row["COL 3"] .
'<td><input type='button' class='buttons' value ='. $row["COL 3"] .
'<td>'. $row["COL 6"] .
'</td></tr>',
您必须使用前面的来转义
'
,如下所示:
echo
'<tr><td>'. $row["COL 2"] .
'<td><input type='button' class='buttons' value =''. $row["COL 3"] .'' />
...
或者,您可以通过"
作为以下示例更改 HTML'
:
echo
'<tr><td>'. $row["COL 2"] .
'<td><input type="button" class="buttons" value ="'. $row["COL 3"] .
'" />'
...
根据Ndeapos Silvanus的要求,并根据他的代码,这里是"整个"示例:
echo
'<tr>
<td>'. $row["COL 2"] .'</td>
<td><input type='button' class='buttons' value =''. $row["COL 3"] .'' /></td>
<td><input type='button' class='buttons' value =''. $row["COL 3"] .'' /></td>
<td><input type='button' class='buttons' value =''. $row["COL 3"] .'' /></td>
<td><input type='button' class='buttons' value =''. $row["COL 3"] .'' /></td>
<td><input type='button' class='buttons' value =''. $row["COL 3"] .'' /></td>
</tr>';
或带双引号
echo
'<tr>
<td>'. $row["COL 2"] .'</td>
<td><input type="button" class="buttons" value ="'. $row["COL 3"] .'" /></td>
<td><input type="button" class="buttons" value ="'. $row["COL 3"] .'" /></td>
<td><input type="button" class="buttons" value ="'. $row["COL 3"] .'" /></td>
<td><input type="button" class="buttons" value ="'. $row["COL 3"] .'" /></td>
<td><input type="button" class="buttons" value ="'. $row["COL 3"] .'" /></td>
</tr>';