Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3782056
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T11:01:46+00:00 2026-05-19T11:01:46+00:00

I have always been very confused with URL/HTML Escaping. More recently I looked deeper

  • 0

I have always been very confused with URL/HTML Escaping. More recently I looked deeper into it. Then looking at the PHP Docs for urlencode

$query_string = 'foo=' . urlencode($foo) . '&bar=' . urlencode($bar);
echo '<a href="mycgi?' . htmlentities($query_string) . '">';

I then realized that theres & in most query strings that seems like should be escaped. But it seems to work without escaping. I wonder why, and if its actually required.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T11:01:47+00:00Added an answer on May 19, 2026 at 11:01 am

    Escaping & into &amp; is required in HTML, but it works in most browsers anyway. If it wouldn’t, 90% of the Internet would break. 🙂 It still is good style to escape ampersands, and it is required for the document to pass validation.

    See this W3C document for some good background why (the text focuses on a specific behaviour of PHP, but that doesn’t really matter): Ampersands, PHP Sessions and Valid HTML. Money quote (emphasis mine):

    In order to display reserved characters HTML and XHTML provide a mechanism called character references. The syntax of these is:

    • an ampersand
    • a "code" for the referenced character
    • a semicolon
    • For example, the "less than" character is represented as &lt;.

    Giving the ampersand special meaning makes it, like <, a reserved character, so it also needs to be represented by an entity for it to be used in a document – &amp;

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been looking into benchmarking lately, I have always been interested in logging
I have always been kind of confused by threads, and my class right now
I know this question has been kind of asked and have looked into the
I have been looking for a way to dynamically load functions into c++ for
I have always been a very big fan of the DHTML calendar http://www.dynarch.com/projects/calendar/ I
I have tried very very hard to solve this problem. I have always been
I'm looking to use Drupal from an upcoming project as I've always been very
Hello I have always been thinking which is the best way of writing html
I have always been a bit unclear on the type of tasks that should
I have always been a good boy when writing my classes, prefixing all member

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.