update database

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Scotter
    New Member
    • Aug 2007
    • 80

    update database

    Hi everyone, I've been messing around with coldfusion lately, and I'm having a rough time understanding how to update a database with the values of a form. I have some understanding of SQL, and it seems to me like I shouldnt have too much trouble with this, but I am. The way I have it now is;

    Code:
    <CFIF IsDefined("URL.Do")>
    <CFIF #URL.Do# IS "save">
    <CFQUERY DATASOURCE="scottersNew" NAME="allEmployeeQuery">
       UPDATE employees, employeeInfo
       SET firstName='#form.firstName#',
       lastName='#form.lastName#',
       phone='#form.age#',
       idNumber='#form.idNumber#'
       WHERE idNumber='#URL.ID#'
    </CFQUERY>
    </cfif>
    </cfif>
    Thats the update part, and the url is going through, but i always get the error "Element FIRSTNAME is unidentified in FORM".

    I'm assuming that its a object oriented kinda thing like javascript. like document.form.v alue. Is that right, or is there some other meaning? What is the point of putting "form." in there is kinda what im getting at.


    Thanks,
    Scotter
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    You use "form..." for POST form variables and "url..." for GET form variables. That's probably why it's not working. You're submitting your form with the GET method and checking for POSTed values.

    Comment

    • timselena
      New Member
      • Dec 2007
      • 5

      #3
      That's right. You should really use POST method for your form.
      then you can operate on Form variables.
      For GET, you should operate on URL variables.

      Comment

      Working...