Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

html radio button add to database

 
bhavin ragha
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a html radio button. When the user clicks the submit button, I want the value to be added to a database table.

there are the 4 radio buttons

o a
o b
o c
o d

--- I have used request.getParameter() and I have quoted q1. but when I check to see what is in the database table "null" is added. How do I add the value in the database?

here is my html radio buttons.


... here I am trying to add the value in the table.

 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64683
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Step 1: refactor your HTML code to use lowercase rather than all uppercase. That style of HTML went out in 1998 and is rather unreadable. This won't do anything to solve your issue, but it will make your code more readable and more likely to get you help.

Step 2: Change your form action to submit to a servlet not a JSP. Then move your database code to the servlet. JSPs should not me mis-used in this way, JSPs are for creating views, not for processing form input, and certainly not for performing database access.

Step 3: Once you've done all that, post back with any errors you are seeing in the logs, and an exact description of what is happening. See the FAQ ItDoesntWorkIsUseless (that's a link) for instructions on what information to include.
 
bhavin ragha
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok it worked... and i have made all the changes you said... the data is added in the table... but now i want it to be taken to another jsp bot i dont want to put a url link.

question1.jsp ---> question1.java (servlet) ---> question2 ----> question2.java (servlet) there are 5 questions
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64683
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe this article can help? It explains how data flows in moderne web applications.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic