Pakistan Prime Minister-in-waiting Imran Khan on Friday submitted a written apology and an affidavit to the election commission for violating the electoral code of conduct while casting his vote in the general election on July 25, media reports said.