• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

html radio button add to database

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.

 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Maybe this article can help? It explains how data flows in moderne web applications.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic