As sypher says, you're looking at
php or some kind of
SSI (server side include). This means you run a script from your hosts server for this function. You can get ready-made scripts from the link sypher posted.
Make sure your host has
SSI's or the form will not run.
You can also do a simple version using FrontPage but then you would need your host to have FrontPage extensions running.