The prices of shares on the stock market is primarily dependent on the supply and demand forces. Those companies that show great potential of long term profits attract a greater number of buyers. As a result of this, they see a huge increase in the prices of their shares. This is obviously because their shares are greater in demand.
On the other hand, those companies who do not show great potential for the future have shares that are not priced very high. This is because they are not in demand. This is how the prices of shares in the stock market get regulated. Prices also happen to fall when the supply gets increased and the buyers are lesser in quantity.