View Single Post
  #4 (permalink)  
Old 11-07-2007, 09:54 PM
edhan's Avatar
edhan edhan is offline
WebProWorld Veteran
 

Join Date: Aug 2003
Location: Singapore
Posts: 549
edhan RepRank 1
Default Re: Check data before insert database

Quote:
Originally Posted by imvain2 View Post
Depending on what you really want to do, you have a few options.

You could always use strip_tags to remove those tags.

You could simply do a string replace and replace < with the &ltX and the > with &gtX (I didn't know if the forum would show my character entities correctly or not so replace the X with a semi colon.

Or if you really want to reject, simply use the strpos to detect the exact symbols, if they are found, redirect the user with a message telling them they entered bad characters or if the text is clean then add to the database.
Yes, I am interested in knowing how to use the strpos to detect the exact symbols and redirect user to a message that they have entered bad characters and to re-enter them again. As I am not very familiar of how to write this, appreciate if you can give me the sample code where I can use to implement this checking. Sorry if I am asking too much as I am totally blurred on this.

Thanks!
Reply With Quote