How do I validate (w3c validation) the following line of code (HTML TIDY)

I am getting the flollowing warming message:
line 89 column 3761 - Warning: <a> escaping malformed URI reference

on the following code that I am generating on the fly:

print "<td><a href=\"editVariant.php?mark_id=$mark_id&amp;mark_name=$mark_name&amp;mark_desc=$mark_desc&amp;id=$id&amp;name=$var_name&amp;desc=$var_desc&amp;file1=$file1&amp;file2=$file2\">Edit </a> |<a href=\"uploadFiles.php?var_id=$id&amp;name=$var_name&amp;desc=$desc&amp;file1=$file1&amp;file2=$file2\">Manage files</a>  | <a href=\"deleteVariant.php?id=$id&amp;name=$var_name&amp;desc=$var_desc&amp;file1=$file1&amp;file2=$file2\">Delete </a>| ";

Any suggestions?
Thanks in advance.
awarraicAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

hernst42Commented:
Code looks ok, but might be a problem depending of the content of a variable. Try to use htmlentities(urlencode($variable)) for each variable you output in that code.

Can ypu post the line that generate the error in the validator?
0
awarraicAuthor Commented:
Sure, here's the code output where it's giving the error:
<table><caption>Manage Variants</caption><tr><th>Variant Thumbnail</th><th>Variant Name</th><th>Action</th></tr><tr><td class='table_thumbnail'> <img src='/admin/download/blockS_blk_green_large.gif' alt=' thumbnail' /></td><td> </td><td><a href="editVariant.php?mark_id=152&amp;mark_name=Block S Trademark&amp;mark_desc=The Block S represents the primary mark of Hexon Netoworks. Pay strict attention to its design character as any deviation is deemed unauthorized.&amp;id=210&amp;name=&amp;desc=Trademark&amp;file1=blockS_blk_green_large.gif&amp;file2=blockS_blk_green_large.gif">Edit </a>
0
hernst42Commented:
The problem are the spaces in the href-attribute. Spaces (and other chars) must be escape. So replace all occurences of $var in your string with " . urlencode($var) . " and your file should validate.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

Rok-KraljCommented:
Instead of space in href attribute write:

%20
0
Oddsen84Commented:
Also for debugging purposes you should consider splitting the code into separate lines. This makes it so much easier to find mistakes. Instead when you get a error message for line "xxx" and have to go trough hundreds of characters you only maybe have 10 or 20 characters to go trough.
0
awarraicAuthor Commented:
Yea, sorry, I think this is the piece of code where's the error is. Can't break it further I think because there're so many variables that I am passing to the next page. I don't think I have any extra space in there at though.

><a href="editVariant.php?mark_id=152&amp;mark_name=Block S Trademark&amp;mark_desc=The Block S represents the primary mark of Hexon Netoworks. Pay strict attention to its design character as any deviation is deemed unauthorized.&amp;id=210&amp;name=&amp;desc=Trademark&amp;file1=blockS_blk_green_large.gif&amp;file2=blockS_blk_green_large.gif">
0
Oddsen84Commented:
Ok just a suggestion free from me to you :-) hehe
0
awarraicAuthor Commented:
Thanks much, this function worked great, all warmings are goine. thanks.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.