This is not the correct forum, but I don't see what the correct forum would be. Your issue would be a webserver-specific question--not a programming issue. HOWEVER, you could use PHP to redirect based on the URL...but I don't think that's what you are wanting.
You don't normally have to do anything DNS wise if you have your DNS configured to direct all traffic to your domain to your webserver. It is your webserver that will serve the different content depending on which subdomain was requested.
If you have a domain on a web host goto your control panel in your hosting account and look for a button/link/panel titled subdomains. Most control panels would just have you enter the name of the subdomain and click ok to set one up.