Web Analytics Made Easy -
StatCounter Inserting Data from Form into MS Access Database with Coldfusion - CodingForum

Announcement

Collapse
No announcement yet.

Inserting Data from Form into MS Access Database with Coldfusion

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Inserting Data from Form into MS Access Database with Coldfusion

    Can anyone please tell me what looks wrong with this code? It's only inserting the username and password, but not the other fields.

    newuser.cfm:

    <form action="insert_user.cfm" method="post">

    Login: <input name="UserLogin" type="text"><br>
    Password: <input name="UserPassword" type="text"><br>
    Email: <input name="EmailName" type="text"><br>
    Address: <input name="Address" type="text"><br>
    City: <input name="City" type="text"><br>
    State: <input name="StateOrProvince" type="text"><br>
    Zip Code: <input name="PostalCode" type="text"><br>
    Country: <input name="CountryRegion" type="text"><br>
    Company: <input name="CompanyName" type="text"><br>
    Work Phone: <input name="WorkPhone" type="text"><br>
    Work Extension: <input name="WorkExtension" type="text"><br>
    Home Phone: <input name="HomePhone" type="text"><br>
    Mobile Phone: <input name="MobilePhone" type="text"><br>

    <input type="submit">

    </form>




    insert_user.cfm:

    <CFQUERY DATASOURCE="realestate" NAME="insert">

    INSERT INTO Contacts(UserLogin, UserPassword, Address, City, StateOrProvince, PostalCode, CompanyName, WorkPhone, WorkExtension, HomePhone, MobilePhone )

    VALUES('#form.UserLogin#', '#form.UserPassword#', '#form.Address#', '#form.City#', '#form.StateOrProvince#', '#form.PostalCode#', '#form.CompanyName#', '#form.WorkPhone#', '#form.WorkExtension#', '#form.HomePhone#', '#form.MobilePhone#', '#form.EmailName#')

    </CFQUERY>
    Edit/Delete Message

  • #2
    It looks okay, what type of error message are you getting? If no error message do you have access to turn on debugging for your IP? you should be able to look at the debug code to see exactly what is being inserted.

    Comment


    • #3
      One more thing that comes to mid is the database field size. I don't see any max limitations in your input tags. The address that is being put in may be too big causing it to error out.

      Comment


      • #4
        Use cfqueryparam in your sql statement, its good coding practice to do so.

        Comment

        Working...
        X