What did dinosaurs evolve from? Was it the reptiles that evolved from amphibians? I have been researching this but am very confused with who their direct predecessor was. Amphibians evolved from fish...reptiles from amphibians...dinosaurs from reptiles (?)...and birds from dinosaurs. That is my understanding, but it could be wrong. How are dinosaurs related to reptiles? And if they did evolve from reptiles, which kind of reptiles (such as lizards, crocodiles, or turtles for example)?
Source of information
See the post The best free and most up to date phylogenetic tree on the internet? for info about how to find such information.
Generally speaking, you might be interested in an intro to phylogenetics such as the one provided in this answer for example.
Where are dinosaurs in the tree of life?
Dinosaurs fall within the Reptiliomorpha clade. Please note that Reptiliomorpha does not quite correspond to what we today call reptiles. Please see the post If dinosaurs could have feathers, would they still be reptiles?
Reptiliomorpha is the sister clade to Amphibia (from here) which contain all living amphibians.
If you look within the Amniota, you will find all of the following
Here, you see that turtles and mammals are an off-shoot of Diapsida. So dinosaurs are not mammals and there are not closely related to turtles. Now if you click on Diapsida you will find ...
the Archosauromorpha which contains all crocodiles, birds and dinosaurs. You can keep going to find Therapoda which contains many dinosaurs and birds. You can keep going like this for yourself and discover the entire tree of life!
Reacting to your sentences
What did dinosaurs evolve from?
When asking this question, please do not forget that no species evolved from an extant species. If this is unclear to you, you should have a look at this post.
Was it the reptiles that evolved from amphibians?
Amphibians evolved from fish...
Well... sure. However, fish is also not monophyletic so it is misleading. Also, I am afraid when you say "Amphibians evolved from fish" that you are thinking of modern extant fish which would be wrong.
reptiles from amphibians...
Nope, this is wrong. Reptiles and amphibians are sister(-ish) clades.
dinosaurs from reptiles (?)...
This is more or less true although again, do not think of modern reptiles and also, reptiles is a mess because it is not a monophyletic group. But Dinosaurs are Reptilia
and birds from dinosaurs.
Yes, this is pretty much true.
Note generally though that it is misleading to say "birds evolved from dinosaurs", "humans evolved from apes" and "mammals evolved from vertebrates". It is more correct to say "birds are dinosaurs", "humans are apes" and "mammals are vertebrates". I would be even better to use the latin names to avoid confusion with misuse of these words in the popular culture.