Re: $_POST case sensitivity
- From: Jerry Stuckle <jstucklex@xxxxxxxxxxxxx>
- Date: Mon, 07 Jul 2008 16:37:03 -0400
Jeff wrote:
Jerry Stuckle wrote:mike.coakley@xxxxxxxxx wrote:Jerry,
I can appreciate your view point. Maybe I did assume too much with my
reply. I was assuming that Bill would understand my intention with
first giving him the answer he was looking for (array_change_key_case)
and then expanding to fulfill a comment someone else made in the
posts, to me if you are iterating over the data received from a HTML
form you should only iterate once if possible and that is why I made
the natural "leap" to offer some filtering advice as well.
So... BILL - please understand that all you need to use is
array_change_key_case to resolve the issue you have requested within
this topic. However, off topic of course, you can use htmlentities to
encode/filter HTML form data received via the $_POST array to
effectively strip the users input of HTML entities while still
retaining their display value. (Definitely read the linked docs in my
last reply.) You absolutely should understand what issues htmlentities
could cause your data input routines and ensure that all of those
involved understand how its filtering will affect your workflow.
Jerry - if you would, even off list - let me know the issues you have
had with htmlentities. I've used it for a while now and would like to
know what problems it can cause.
Thanks,
Mike
htmlentities() is not the correct function to use here. It is used to write strings which may contain html special characters (like '<' and '>', for instance) to an html page.
Say we have a textarea:
<textarea> $value </textarea>
What would be the proper processing needed for $value? I'm using htmlentities for my textfields and selects and I assume that is correct, but $value could contain html and I'm unsure what to do there as I don't want to turn <br> into <br> but I also don't want to break this if
there is a textarea tag in $value.
Jeff
It is not meant to be used on inputdata, and its use in that situation is incorrect.
Jeff,
Yes, you use htmlentities (or htmlspecialchars()), but you use it when you output your data, not when you get it in.
You want the input string as it stands so you can parse it as necessary. Once you're happy the string is valid, you use one or the other to display the data.
So for instance, if the user input
Visit web page at <a href="http://www.example.com">example.com</a>!
and you want to check for any html attributes, you can search the string for '<'. If you run the string through htmlentities() first, you have to look for '<' - which is much less clear.
But to display it in a non-text area element, you would call htmlentities() to display it.
Also, you if you were to store the string in a database, you would want to do it before calling htmlentities(). Again, call it just before displaying the string (in a non-text area element).
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@xxxxxxxxxxxxx
==================
.
- References:
- $_POST case sensitivity
- From: Bill H
- Re: $_POST case sensitivity
- From: Tim Roberts
- Re: $_POST case sensitivity
- From: Geoff Berrow
- Re: $_POST case sensitivity
- From: Jerry Stuckle
- Re: $_POST case sensitivity
- From: Bill H
- Re: $_POST case sensitivity
- From: mike . coakley
- Re: $_POST case sensitivity
- From: Jerry Stuckle
- Re: $_POST case sensitivity
- From: mike . coakley
- Re: $_POST case sensitivity
- From: Jerry Stuckle
- Re: $_POST case sensitivity
- From: Jeff
- $_POST case sensitivity
- Prev by Date: Secret WEB CAMS at HOTELS & LODGES
- Next by Date: Re: createimagefromstring / createimagefromjpeg
- Previous by thread: Re: $_POST case sensitivity
- Next by thread: Re: $_POST case sensitivity
- Index(es):
Relevant Pages
|