first, the constant for an weak acid is:
k = [H+] [A-] / [HA]
or in general, its k = [products] / [reactants]
when doing pH, most ppl take pH of weak acids or a general reaction that is not the dissociation.
u are not allowed to take the pH of a strong acid, coz if all if the acid dissassociated, there would be 0 concentration of reactants left, and dividing by zero is undefined here, therefore you cant take negative log of that anyways