By: Rhino

<--- Your basic HTML form with two boxes for first and last name --->




        <form method="POST" action="newposition.cfm">
            <font face="Century Gothic" size="2">
                First: <input type="text" name="firstname">
                Last: <input type="text" name="lastname" size="20" tabindex="2">
                <input type="submit" value="Submit" name="B1" tabindex="3">


<--- NEW FILE: newposition.cfm --->
<--- First you insert the three basic parts, or two, or just one. Here I do three. --->

<cfquery name="[ queryname ]" datasource="[ dsn ]">
    INSERT INTO [ tablename ]
                        'National Council'

<--- Then we grab the highest ID from the DB, which should be what was just entered --->

<cfquery name="[ queryname ]" datasource="[ dsn ]">
    SELECT MAX(ID)as newmem
    FROM [ tablename ]

<--- Now we go to the edit form to edit the information related to the highest ID --->

<CFLOCATION URL="[same file as used for updates].cfm?id=#[queryname].newmem#">

About This Tutorial
Author: Rhino
Skill Level: Beginner 
Platforms Tested: CF5
Total Views: 63,766
Submission Date: April 07, 2004
Last Update Date: June 05, 2009
All Tutorials By This Autor: 10
Discuss This Tutorial
  • I used this approach when adding new users to my site. I simpy enter their userID, firstname, lastname and hit submit. The next page I see has their birtdate, contact information, etc. I took your approach and just removed the organization from it. Works like a champ and I no longer have keep two forms updated (insert form and an edit form) just as your titles suggests.

  • National Council, not New Council.

  • I dont understand. You are adding a person with New Council as their organization but what if you didn't want their ogranization to be that? I understand what the page is doing but not how it would benefit me... Can you provide more details, please? From a tutorial standpoint, it is lacking so I rated it as two stars.


Website Designed and Developed by Pablo Varando.