Skip to main content
Inspiring
May 9, 2017
Question

W3C errors on PHP URL String variables

  • May 9, 2017
  • 5 replies
  • 3284 views

I have designed a Real Estate webpage that has over 100 URL Links that pass to another page for a database table query. The page works but when I run a W3C check on the page I get errors. see below for the error from W3C check.

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

At
line 108, column 67

.php?company_id=010002&id=1000

Here is the complete line of code.  As I said, the code as written below works, but produces W3C check errors.

How can I re-write this code so it passes the W3C check.

Here is the existing line of code:

<a
href="http://mlsonlinecr.com/mlshomesforsale_page.php?company_id=010002&type=%25&city=%25&province=%25&submit=Search#result">Homes</a></li>

<li><a
href="http://mlsonlinecr.com/mlshomesforsale_page.php?

    This topic has been closed for replies.

    5 replies

    Inspiring
    May 15, 2017

    Maybe I did not clearly explain the problem.  I continued to work on a solution and have now resolved the problem.

    Here is the old URL Link that worked on the page, but produced a W3C error (online w3c check of the host page) followed by the new link that uses php variables for the string variables.

    Hope this clarifies things.   With the above change, The problem is now solved.

    Inspiring
    May 15, 2017

    Maybe I did not clearly explain the problem.  I continued to work on a solution and have now resolved the problem. 

    Here is the old URL Link that worked on the page, but produced a W3C error (online w3c check of the host page) followed by the new link that uses php variables for the string variables.

    Hope this clarifies things.   With the above change, The problem is now solved.

    Nancy OShea
    Community Expert
    Community Expert
    May 9, 2017

    As PZ said, W3C validation is useless on raw PHP code.  You need to check the Live Code.

    Assuming you have a local PHP development environment set-up in CC 2017,  open your PHP document.  Go to View > Live Code.  This will parse the PHP code and display the document as one would see it in a browser on the server.

    Go to Window > Results > Validation.

    Click the triangle to check Live Document.  See screenshot.

    Nancy

    Nancy O'Shea— Product User & Community Expert
    Rob Hecker2
    Legend
    May 9, 2017

    Just to be clear, the W3C checker does not see your PHP code, unless the code is not correctly contained within code tags.

    You may want to use the PHP functions urlencode and urldecode on your urls to make sure the urls don't contain anything that will break. I do see a blank space in provin ce, which would be a problem.

    Inspiring
    May 9, 2017

    Rob, thanks for the reply.  The space in pro vince  is not in the code.  It happened when I copied and pasted.  Do you have any examples of using the urlencode on the strings.    The webpage that I am working on is located at this link. The example that I included in the forum  is in the TOP Navbar  "HOMES":  Real Estate, Costa Rica Baby Boomers

    Jon Fritz
    Community Expert
    Community Expert
    May 9, 2017

    You are missing the ending double quotes in several of your links href attributes. For example...

    <a href=http://www.mlsonlinecr.com/mlshomesdetail.php?company_id=010002&id=10004&submit=Search>

    ...needs a " right before the ending >

    It looks like pretty much all of that style of link in the page are missing the quote at the end.

    pziecina
    Legend
    May 9, 2017

    You cannot.

    The W3C checker can only check html or css code, and flags anything else as an error. To check your html or css then you will have to do this before inserting the php code, or ignore errors that you know are php code.