There is really only one rule:
"NEVER EVER TRUST ANY DATA COMING FROM THE CLIENT"
This means:
1) Never blindly insert user input into your database, especially if you are going to display it later. Evil users like to do nasty things with < script > or PHP tags.
2) Always do bounds checking.
3) Always make sure the user is authized to do the action the page is taking. Don't assume the user reached that delete record page legitimately, verify that they are authorized to take this action on this record or record set.
4) Don't let users upload PHP (or other http "executable [perl, cgi]) files into the web tree. Always limit the size of uploads.
I'm sure there are a million more, but I'll let someone else chime in.