No acceleration with gas pedal

I was driving home from work yesterday when I came to the stoplight. When it finally turned green I pressed on the gas pedal but the car moved forward slowly as if I had only taken my foot off the brake. I was able to crawl to a parking lot and move the gear shifter into different positions and gears but got no response in any of the gears. When I put the car in park and in neutral and pressed on the accelerator the engine would rev but as soon as I put in drive it wouldn’t do anything. My tachometer never increased. While i was waiting for my wife to come and get me the lights on the inside of the car started to go out, my airbag light came on and then the car almost died. My wife came and picked me up and tried to start the car but I only got the rapid clicking. Today when I went back to try it again it started without a problem, went into gear without a hitch and I drove it around the parking lot. I had my wife come over to follow me back home just in case it happened again but by the time she got there the accelerator stopped working in the drive position. I turned the car off and tried again only to get the clicking sound. The battery was replaced 6 months ago. The battery light did come on 2 nights ago as did the brake light even though the brake is not engaged. The battery contacts were changed when the batter was changed 6 months ago. Any ideas?