Let's look at a simple form and check out what gets sent:
1. Create a file in your application by the name
contact.cfm
and create a simple HTML page within this file:<!DOCTYPE html > <html lang="en"> <head> <title>Contact Form</title> </head> <body> <h1>Contact Us</h1> <form action="contact.cfm" method="post"> <p> <label for="name">Name</label><input type="text" name="name"> </p> <p> <label for="email">Email</label><input type="email" name="email" > </p> <p><input type="submit" value="Send"></p> </form> </body> </html>
Now, if you load this template in your browser, you should see the following:
2. This form posts to itself, as you can see through
action="contact.cfm"
in the form tag. We also havemethod="post"
to make sure we are accepting a form post. Now if we submit this, we will get no output...