Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    May 2006
    Location
    Calpines, California
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 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
    New to the CF scene
    Join Date
    Jul 2002
    Location
    Florida
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #3
    New to the CF scene
    Join Date
    Jul 2002
    Location
    Florida
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #4
    New Coder
    Join Date
    Feb 2007
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Use cfqueryparam in your sql statement, its good coding practice to do so.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •