I was just wondering if you could do this, and if so, how.
Thanks,
CoW
how to limit HTML input in a form box
Moderator: General Moderators
-
SL-Cowsrule
- Forum Newbie
- Posts: 13
- Joined: Sat Oct 12, 2002 5:08 pm
e.g.
But the client may choose to ignore it or the user can transmit the data in another way, so you have to also check the input server-side (e.g. by strlen()) if necessary.
Code: Select all
<input type="text" name="xyz" maxlength="20" />-
SL-Cowsrule
- Forum Newbie
- Posts: 13
- Joined: Sat Oct 12, 2002 5:08 pm
sorry for not making myself clear, i meant if i could disable the persons ability to use html code, or have the code be taken out or something, or maybe not displayed from a database. Im not sure if i can use an HTML function or if this is php.
i looked at w3c.org under the form syntax and didnt see anything... so imguessing this is php.
Thanks,
CoW
i looked at w3c.org under the form syntax and didnt see anything... so imguessing this is php.
Thanks,
CoW
- mydimension
- Moderator
- Posts: 531
- Joined: Tue Apr 23, 2002 6:00 pm
- Location: Lowell, MA USA
- Contact:
yep, php has great functionality for that. see http://php.net/strip-tags
Using MySQL and PHP and Apache latest, I have only had to convert apersands and use the addslashes command to get the data to store and retrieve correctly.
For example I would type in something like:
Ofcourse when this gets pulled out later the HTML is converted which is what I want and gets displayed correctly. The slashes that might be added before the Single or Double Quotes never have to be changed again. The ampersand would be fine left alone in the database and for display purposes seems to display fine in IE6, but for HTML401Transitional compliance needs to be changed to &
For example I would type in something like:
Code: Select all
So and so said this "Blah Blah Blah!" If you want to read more about blah check it out <a href='http://www.blah.com/something.php?one=1&two=2'>here</a>.