There are a couple different technologies out there for dynamic websites. One flavor is Microsoft’s ASP.NET. Another is Java’s JavaServer Faces. Both technologies have their pros and cons. I would spend some time looking between the two. I enjoy working with Microsofts ASP.NET due to its IDE, Visual Studio 2005. But JSF has many features that I wish ASP.NET would have.
To get started with ASP.NET, check out Microsoft’s Visual Studio 2005 Express (which is free) and check out some artciles. For the Java flavor, try downloading the Netbeans IDE, and the J2SE and J2EE SDK’s. There are many online resources to guide you along the way. Also it is important to mention that websites like myspace, and facebook uses database backends. So you should probably be familiar with database systems such as SQL Server and/or MySQL.
I know that you can use PHP for web programming, but I have little experience with PHP development. Hope this helps a little.