elwindly
elwindly

Reputation: 45

W3C validation Illegal character in query: not a URL code point

The w3C validator has found an error in my HTML:

Bad value comment_add.php?id= 7 for attribute action on element form: Illegal character in query: not a URL code point.

It marked the closing ">" tag as a problem

<form method="post" action="comment_add.php?id= 7"**>**

The code which generated that HTML is:

<form method="post" action="comment_add.php?id=<?= $id_post;?>">

I have a few other lines with the same issue.

How can I solve this problem?

Upvotes: 1

Views: 2515

Answers (1)

Kara
Kara

Reputation: 6226

There should not be any spaces in the action of the form.

You should change your code to:

<form method="post" action="comment_add.php?id=<?=$id_post;?>">

If you need a space in your URL is should be encoded as %20. So the code would then look like:

<form method="post" action="comment_add.php?id=%20<?=$id_post;?>">

Upvotes: 3

Related Questions