Welcome to the Site IsaacZ.
The IPO price is set between the underwriters and the specialist in the NASDAQ. There is a lot of complexities on how to get to this price, everyone is trying to pull to their own side. In Facebook example, the price was $38 for all IPO participants. Once the IPO went to secondary market, the bid/ask drove the pricing.
At the secondary market the price is diven by the demand and offer of the stock.