Why is my density altitude calculation different from ForeFlight's?

The dewpoint temperature is also needed for Density Altitude calculation and is not included in many basic density altitude calculations. Here is a good website for calculating DA. Notice the use of Dewpoint in this calculation.

The density of the air is affected by both temperature and moisture content with temperature the biggest factor.

In order to properly calculate the density altitude, the virtual temperature must be used, not the actual temperature. Virtual temperature is the temperature that air will achieve if all of the moisture was removed. Many thermodynamic equations become much easier with virtual temperature since it greatly simplifies the thermodynamic equations.

The best way to visualize virtual temperature is using two parcels of air - assuming the same pressure for both parcels, of course.

Parcel One: This air parcel has some measured temperature T1. It also has some moisture in the parcel. As a result, the parcel has a density D.

Parcel Two: This air parcel also has density D, but has no moisture. Obviously, if it has the same density with no moisture, it must have a different temperature. To achieve density D, the temperature of the second parcel must be greater than that of the first parcel. This new temperature T2 is called the virtual temperature. The virtual temperature is higher and essentially accounts for the moisture that is in the air.