1998 VW Golf revvs too high

While driving home from work the other day, just a little more than 1-mile from my home, my VW Golf just stopped running. It would almost turn over, but not stay running so I could not get going. Once I got towed to home, I was able to get the car to turn over, it starts strong, then revs very high and if I try to put it into gear it stops running. What is wrong?
Thank you