2016-04-08 9 views
0

エラーは、私は自分のコードの検証時にPHPコードが

print("<tr class='pointer' onclick=location.href='inventory.phpsetID=$setid&catID=$catID'>"); 

がエラーをトリガラインを印刷HTMLの検証時に:私はそれをトリガーするかわからない

Error: "=" in an unquoted attribute value. Probable causes: 
Attributes running together or a URL query string in an unquoted attribute value 

Link to validator

をし、エラーの説明を理解していない。

答えて

0

変更しますが、これにコード:

print("<tr class='pointer' onclick=\"location.href='inventory.php?setID=$setid&catID=$catID'>\""); 

の値onlick属性は引用符で囲む必要があります。

+0

ありがとうございました! –

+0

@SimonForsbergありがとう、これをお読みくださいhttp://stackoverflow.com/help/someone-answers – Pradeep

1

あなたがPHP連結演算子.を使用して変数に文字列をCONCATする必要があります。

print "<tr class='pointer' onclick=location.href='inventory.php?setID=" . $setid . "&catID=" . $catID "'>" 
+0

これはうまくいきません!! – Pradeep

1

あなたのクリック時には内部の引用符にする必要がある、と変数は引用符の外にする必要があります。

print("<tr class='pointer' onclick=\"location.href='inventory.php?setID=" . $setid . "&catID=" . $catID . "'>\""); 
関連する問題