html tags should be stripped or replaced with html entities before printing to output, not necessarily before being put into a database. many programs will save editable data, and preformatted data to improve performance. for instance if someone puts (i know i know) bbcodes into a form, you would want to save one version as the user entered it, and one version that has the bbcode parsed and the html cleansed. cleaning html out of the content is only done to prevent users from putting malicious javascript into you page, allowing them to access information or modify the system without credentials. see xxs or cross site scripting.
data from the user should never be trusted and should be validated and filtered to the furthest degree. this means escaping everything before putting it into your database. this can be done using functions like mysql_real_escape_string() for mysql, or prepared statements with PDO. see sql injection attacks.
a tricky one is making sure that a request is coming from the intended logged in user. for instance, if you are logged into your banks website, and i send you an email with an image tag in it <img src="www.yourbank.com?func=transfer&account=1234&amount=10000" />
. will this cause you to transfer your money to me? don't allow any requests that modify system data from GETs for starters, but this could come through posts if javascript or viruses are involved. people also often save a form instance id with each form they send to a logged in user in session, as well as in the form itself. they would then check incomming requests against that list of form instances, ignoring ones that it did not send out itself. see csrf or xsrf.
make sure your sessions are stored in a safe location. validate sessions with at the very least the browser that sent the request, meaning store the browser that sent the log in request, and check it each time the user submits another request to verify that it is the same browser. some also incorporate parts of the ip address into this session validation.
scrub all file uploads. if someone were to upload a file named some.jpg.php which is a valid jpg, but has PHP code instide of the jpgs meta notes. the uploader could feasably take over your server. be sure at the very least to use your own file extensions for uploaded files. some would even suggest store all uploaded files in a private location, and then setting up a file server script to serve those files using PHP. some would even suggest scanning uploaded files for viruses. checking the MIME type is of no protection.
make sure that your PHP and server settings are set up with best practices in mind.
i'm sure there is more as you can never be too careful, but this is a good start.