0

The line

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

triggers errors when I validate my code:

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

Link to validator

I don't know what triggers it, and don't understand the explanation of the error.

3 Answers 3

1

You need to concat the string with the variable using the PHP concatenation operator .:

print "<tr class='pointer' onclick=location.href='inventory.php?setID=" . $setid . "&catID=" . $catID "'>"
Sign up to request clarification or add additional context in comments.

Comments

1

Your OnClick needs to be inside quotes, and the variables should be out of the Quotes.

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

Comments

0

Change you code to this:

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

The attribute onlick's value should be inside quotes.

1 Comment

@SimonForsberg thanks, please read this stackoverflow.com/help/someone-answers

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.