行
print("<tr class='pointer' onclick=location.href='inventory.phpsetID=$setid&catID=$catID'>");
当我验证我的代码时触发错误:
Error: "=" in an unquoted attribute value. Probable causes:
Attributes running together or a URL query string in an unquoted attribute value
链接到验证器
我不知道是什么触发了它,也不理解错误的解释。
您需要使用PHP串联运算符.
:将字符串与变量连接起来
print "<tr class='pointer' onclick=location.href='inventory.php?setID=" . $setid . "&catID=" . $catID "'>"
您的OnClick需要在引号内,变量应该在引号外。
print("<tr class='pointer' onclick='"location.href='inventory.php?setID=" . $setid . "&catID=" . $catID . "'>'"");
将代码更改为:
print("<tr class='pointer' onclick='"location.href='inventory.php?setID=$setid&catID=$catID'>'"");
属性onlick的值应该在引号内。