Re: Check data before insert database
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 <X and the > with >X (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.
|