2003 Civic starting problem


My girlfriend just bought a 2003 civic and after we bought it I filled it up with gas and it wouldn't start. We test drove it and ran it very low on fuel so I just assumed that maybe there was air in the lines or something stupid like that. Then a week later I filled it up again and again it wouldn't start until the 9th or 10th time I turned the key. This happens every time fuel gets put into the tank and last night I started to pump the gas with the car still running by accident and it almost shut off but I stopped pumping before it actually did. What could be the problem?