0

What's the problem?

I am currently trying to validate my client's website, but cannot resolve the following issue.

Bad value /php/captcha_code_file.php?rand= for attribute src on element img: Illegal character in query: not a URL code point.

The full line that the validator points to can be found below.

<html>
<!-- ... -->
<img src="/php/xyz.php?rand=<?php echo rand();?>" id="captchaimg" alt="captcha"><br/>
<!-- ... -->
</html>

What have I done?

It's my understanding that any spaces in URLs are to be replaced with %20, but I can't imagine that would be the problem inside the actual query - especially since I've tried this already and received the same error.


Edit: My question is not about validating the PHP the src property is pointing to, but rather how the value/string is formatted for src.

1 Answer 1

2

You have given the validator the source code to a PHP program, when you should be giving it the HTML document you get when you run the PHP program.

It is a markup validator, not a PHP source code validator.

Sign up to request clarification or add additional context in comments.

4 Comments

So the way I have the value of the src property is correct? I'm not trying to validate the PHP it's pointing to, just the way the HTML shown above is formatted.
Nevermind, I understand what you're saying. Could I remove the php section of the URL and replace it with something else? Or would that be considered forgery, and thus false validation?
Who's going to know if you "forge" it? The validator's results are between you and the computer running the validation software.
You have the ability to link the W3C valid image with the validation results. Regardless, my question was answered.

Your Answer

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