File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Cattle Drive and the fly likes Secret to inserting records from html form????? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » This Site » Cattle Drive
Bookmark "Secret to inserting records from html form?????" Watch "Secret to inserting records from html form?????" New topic

Secret to inserting records from html form?????

Carol Murphy
village idiot

Joined: Mar 15, 2001
Posts: 1202
Is there a secret command to use when inserting a record into a database from a html form? I have been working on JDBC2 from the cattle drive, and for some reason I can't get all of data from my form into the table in the database. There are 3 types of input fields, and they are working properly because I can print out the user input to teh web page, but for some reason only the input from the text fields and radio buttons are being inserted into the database.
My table is set up with 6 columns. The 4 that work are varchar() of different lengths. The 2 that don't work are char(1). I tried changing them to varchar(). Didn't work.
I'm using statement.update( "INSERT INTO MYTABLE VALUES ( '"+variable1+"' , '"+variable2+"' , etc))"
The syntax is the same for all 6 columns, and all 6 columns are being passed an appropriate value, but mysql can't seem to insert the whole row into the table.
I'm starting to obsess over this!
Blake Minghelli
Ranch Hand

Joined: Sep 13, 2002
Posts: 331
Can you show more of your code? Are you getting a SQLException on the INSERT or are just ending up with null values in some of your db fields?

Blake Minghelli<br />SCWCD<br /> <br />"I'd put a quote here but I'm a non-conformist"
David O'Meara

Joined: Mar 06, 2001
Posts: 13459

Since this is a Cattle Drive question, I'm moving it there just in case someone accidentally solves it.
Michael Matola
Ranch Hand

Joined: Mar 25, 2001
Posts: 1793
See the original thread for my working theory on what's going wrong.
I agree. Here's the link:
subject: Secret to inserting records from html form?????
It's not a secret anymore!