In any compound there are two types of ions are present, cations and anions. Cations are positively charged ions and formed by losing electrons and anions are formed by gaining electrons and are negatively charged ions.
So, in K₂HPO₄, there are positive charged and negative charged ions are present. so there is K⁺ ion and HPO₄⁻² ion is present in K₂HPO₄