Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #15709
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Newsgroups | comp.lang.php |
| Subject | Re: rawurlencode problem |
| Date | 2015-10-19 19:35 -0400 |
| Organization | A noiseless patient Spider |
| Message-ID | <n03uk1$m0l$1@dont-email.me> (permalink) |
| References | <d8kekpFmk8uU1@mid.individual.net> |
On 10/19/2015 10:56 AM, Derek Turner wrote: > Hi, > > I'm using this: > > echo "<ol class=\"reader\">"; > while ($row = $result->fetch_assoc()): > echo "<li class=\"reader\"> <a href = \"#".rawurlencode($row > ['name'])."\">" . $row['name'] . "</a></li>\n\n"; > endwhile; > echo "</ol>"; > > 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 "<h2 id =\"" .rawurlencode($row['name']). "\">" . $row > ['name'] . "</h2>"; > 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???? > Don't worry about "Pointed Head"'s comments. Erwin has an excellent suggestion for you. The only other suggestion I would make is related to J.O.'s suggestion - since you already have a unique id which doesn't contain spaces, you could use that as an anchor instead of the row name, i.e. <li class=\"reader\"> <a href = \"#".#row['id'])."\">" . $row['name'] . "</a></li> This would provide an id of 'i123456' or similar without having to worry about spaces and special characters. And don't worry about "Pointed Head". He's a well-known troll who doesn't understand even the simple concepts of programming, and has to repeatedly prove his ignorance. -- ================== Remove the "x" from my email address Jerry Stuckle jstucklex@attglobal.net ==================
Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
rawurlencode problem Derek Turner <frderek@suremail.je> - 2015-10-19 14:56 +0000
Re: rawurlencode problem Erwin Moller <erwinmollerusenet@xs4all.nl> - 2015-10-19 17:18 +0200
Re: rawurlencode problem Derek Turner <frderek@suremail.je> - 2015-10-19 15:48 +0000
Re: rawurlencode problem Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-10-20 00:02 +0200
Re: rawurlencode problem Erwin Moller <erwinmollerusenet@xs4all.nl> - 2015-10-21 09:40 +0200
Re: rawurlencode problem "J.O. Aho" <user@example.net> - 2015-10-20 18:33 +0200
Re: rawurlencode problem "J.O. Aho" <user@example.net> - 2015-10-19 21:27 +0200
Re: rawurlencode problem Derek Turner <frderek@suremail.je> - 2015-10-19 19:43 +0000
Re: rawurlencode problem Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-10-20 00:03 +0200
Re: rawurlencode problem "J.O. Aho" <user@example.net> - 2015-10-20 07:10 +0200
Re: rawurlencode problem "J.O. Aho" <user@example.net> - 2015-10-20 07:21 +0200
Re: rawurlencode problem Derek Turner <frderek@suremail.je> - 2015-10-20 08:29 +0000
Re: rawurlencode problem "J.O. Aho" <user@example.net> - 2015-10-20 18:29 +0200
Re: rawurlencode problem Arno Welzel <usenet@arnowelzel.de> - 2015-10-27 14:01 +0100
Re: rawurlencode problem Arno Welzel <usenet@arnowelzel.de> - 2015-10-27 14:04 +0100
Re: rawurlencode problem Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-10-20 00:00 +0200
Re: rawurlencode problem Jerry Stuckle <jstucklex@attglobal.net> - 2015-10-19 19:35 -0400
Re: rawurlencode problem Derek Turner <frderek@suremail.je> - 2015-10-20 08:34 +0000
Re: rawurlencode problem Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-10-21 13:54 +0200
csiph-web