This is for a simple submit into a database. I have two tables. One is called "Authors", while the other is called "corpPosts".
The Form consist of a Title, and a Body value that will be inserted as a new entry into the corpPosts Table.
The form also consists of a drop down box which collects values from the Authors table. The user clicks the designated author to decide who posted the blog.
Once the form is submitted, it Creates a new record in the corpPosts Table, inserting the Title, Body, as well as the author into the corpposts table. The Author in the corppost table is represented by "UserID".
I do not remember how to associate the AuthorName to the UserID however. I know this is a relatively simple query.
<cfform action="AddCorp.cfm" method="post">
<cfinput type="text" reqired="yes" name="Title" id="Title">
<textarea style="width: 1000px; height: 600px;" name="CorpBody" id="Body"></textarea>
<select Name="SelectAuthor">
<!--- Queries --->
<cfquery name="Authors" datasource="corpposts">
SELECT Name
FROM Authors
</cfquery>
<cfoutput QUERY="Authors"><option>#Name#</option></cfoutput>
</select>
<cfinput type="Submit" name="Submit" id="Submit" value="Submit">
</cfform>
On the Next Page:
<!--- Query to Insert --->
<CFQUERY name="AddPosts" datasource="corpposts">
INSERT INTO CorpPosts (Title, CorpBody, UserID)
VALUES
('#Form.Title#', '#Form.CorpBody#', '#Form.UserID#')
</CFQUERY>