Here's a quick example using HTML + PHP (forgoing javascript for simplicity)
HTML Page (index.html):
<html>
<head>
<title>My Cool Form</title>
</head>
<body>
<!-- Set the action to the page that will handle the form data -->
<form action = "thanks.php" method="post">
<!-- The name attribute will be used by thanks.php later -->
E-Mail: <input name="email" type="text"></input>
<input type="submit" value="Submit"></input>
</form>
</html>
thanks.php:
<?php
$to = "[email protected]"
$from = "From: [email protected]";
$subject = "Got a result from the form!";
// Get the e-mail from the form
$email = $_POST['email'];
$body = "The persons e-mail is" . $email;
// Send an e-mail to [email protected]
mail($to, $subject, $body, $from);
?>
<html>
<head>
<title>Thank you :)</title>
</head>
<body>
Thanks for your submition. We have added
<?php
echo $email;
?>
to our mailing list!.
</body></html>
HTML is a markup language used to define your document and forms. This is used by your browser to create the webpage seen by your user.
PHP is a server-sided language which runs on your server, not the users, that accesses data such as information from forms, databases, rss feeds, etc and then processes the data (for example mailing the form results to you) before sending the user a HTML document (like one that says thank you for you submition, latest blog posts from a database, etc).
Find a nice free host and upload these files to see them in action.