State law limits a party to one candidate on the November ballot.
Foster accused Fattah's campaign of shenanigans - which it denied - and protested that he belonged to no party.
He filed an appeal with Commonwealth Court, which ruled he could run under a different affiliation.
The court also found that he could be listed as an "independent" if Ogborn's petition were ruled invalid. Foster then filed a challenge to Ogborn's signatures.
That challenge became moot Friday afternoon when Ogborn pulled out of the race.
Ogborn's petition contained 2,000 signatures, 285 more than the minimum. However, Ogborn acknowledged that a review showed he did not have enough valid ones.
He said that "a lot" of the signatures were those of college students who listed addresses that did not match voter records.
"I'm not going to fight this," he said. "Why draw this out?"
Foster said he actually was grateful for the flap and the subsequent attention. He said a ward leader told him, "Jim, this is the best possible way you could have announced the race."
Fattah won reelection in 2010 with 89.3 percent of the vote.
Ogborn said he had not decided whom to support in the congressional election and did not rule out voting for Foster.
As for his own political future, he said, "The mayor's race is only two years away."
Contact Anthony R. Wood at 610-313-8210 or firstname.lastname@example.org.