
Originally Posted by
mrjc99
if rocky planets only form near the sun,
That is not the case. They can be anywhere within the system. Note how many Kuiper Belt objects are rocky planetoids. Gas giants can also form near to a star- quite near, considering the evidence of several "Hot Jupiters" around other stars.

Originally Posted by
mrjc99
and why are moons that orbit the same planet so different from each other?
Because captured moons are not selected, they are simply captured in the gravity well of a larger object.
In the early formation of a solar system, many collisions will occur and many system objects will move around a bit before finally settling somewhere in a stable orbit.
The most prominent theory of Earths Moon is that it was formed when a planetoid whacked the Earth, breaking off a large chunk that eventually formed an oblate spheroid and settled into orbit around the Earth as our Moon.

Originally Posted by
mrjc99
shouldn't they have been formed by the same materials?
The abundance of materials in a particular section of planetary gas during formation is largely determined by gravity. Once the solar objects have formed, however, there is still (relatively) a lot of activity- collisions, disturbed orbits that move an object into a new orbit pretty far from where it began and captured objects- see below about the asteroid bit for more.

Originally Posted by
mrjc99
also, what stops the asteroids in the asteroid belt
The tug from nearby Jupiter and from the more distant Sun constantly knead the asteroid belt, a bit like stirring sand beneath a pier or dock to prevent seaweed from being able to settle in and grow.

Originally Posted by
mrjc99
and kuiper belt from acreting into giant planets? thanks.
There isn't really anything about the kuiper belt that would have prevented the formation of large planets. In our solar system, that simply is not how it worked out. In other solar systems, there may well be massive planets at a great distance from the host star. There are several rocky planets out there, including Sedna.