Path: csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: "J.O. Aho" Newsgroups: comp.lang.php Subject: Re: rawurlencode problem Date: Mon, 19 Oct 2015 21:27:54 +0200 Lines: 45 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Trace: individual.net KhYVd40IB56QqAGUzLfz+Q+SakQzw1Ge9ysg1ByWvfxbyTjm7U Cancel-Lock: sha1:OyEWvq/nlig2x8tLLnmBaRrosdE= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 In-Reply-To: Xref: csiph.com comp.lang.php:15704 On 10/19/2015 04:56 PM, Derek Turner wrote: > Hi, > > I'm using this: > > echo "
    "; > while ($row = $result->fetch_assoc()): > echo "
  1. ['name'])."\">" . $row['name'] . "
  2. \n\n"; > endwhile; > echo "
"; > > to provide links for screen-readers to various points in my page > $row['name'] may and does contain white spaces in many records. > > The code works fine without the rawurlencode but fails validation > > similarly this code lower down: > > while ($row = $result->fetch_assoc()): > echo "

" . $row > ['name'] . "

"; > etc. > > works without the rawurlencode but fails validation as 'id' must not > contain white space. > > SO the link href and the id are identical apart from the leading # > > PROBLEM: this passes validation but DOES NOT WORK. Clicking the links > does not move the page. Without the second rawurlencode it works! > > What am I missing???? > The standard is to use a numeric id in the database, it's a lot easier to validate that it seems to be okey and numeric index in the database is faster than varchar/text based. I would recommend a redesign of your database and it will solve your problem too. -- //Aho