0

Is there a way that if I click on a radio button, it inserts its value to database?

<form name = "data" method = "post" action = "JSP/insert.jsp">
<p>
<font size = "4">
Rate: 1<input name="radio_rate" type="radio" value="1" onclick="return validate()"/>
2<input name="radio_rate" type="radio" value="2" onclick="return validate()"/> 
3<input name="radio_rate" type="radio" value="3" onclick="return validate()"/> 
4<input name="radio_rate" type="radio" value="4" onclick="return validate()"/>
5<input name="radio_rate" type="radio" value="5" onclick="return validate()"/>
</font>
</p>
</form>

validate() javascript just checks if the user is login or not (facebook JS SDK).

what I want to do is that upon clicking the radio button, I want to insert its value to database.

document.data.submit();

I direct the page to insert.jsp using the above JS code:
INSERT.jsp

function goback() {
location.href = "//previous page";
}
<body onload="javascript_:goback()">
// INSERT to database
</body>

I am not sure if I did it in a right way. IF there is a better way please let me know

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by Shanti C
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.