There is a condition which causes this and only a veterinarian can diagnose your dog. Please get your dog to the vet soon.
Your dog needs to be seen by a vet as soon as possible. There are a couple of things that can cause weakness in the hind legs, they are all pretty serious and require veterinary intervention.
Lumbosacral stenosis syndrome causes nerve damage that causes weakness in the back legs, as does a nerve disorder called degenerative myelopathy. While these things are much more prevalent in larger breeds they can affect any breed.
A disease called Cushing's Disease can also cause weakness in the legs. This is caused by a tumor on the pituitary gland and the presence of Cushing's can be determined by a blood test.
Please let us know what the vet says.
Ghilly