Hi Friends, 

I have pasted below my code, I need to get two values & it pass to the 
VisitDetails Servlet. One is "visit_id" by radio button and second is 
"visit_type" but as per the below code I am getting only first row value of 
"visit_type" which fetched from the database. But when user will select any 
other row I needs that row's "visit_type" value only. 

    <center> 
        <form method="post" action="VisitDetails"> 
            <table border="1"> 
                <tr> 
                    <td>Visit Type</td> 
                    <td>Visit Code</td> 
                    <td>Visit Date</td> 
                    <td>Visit Status</td> 
<td>Category</td> 
                    <td>Select Visit</td> 
                </tr> 
                <% 
                    try { 
                        String patMRD = request.getParameter("pMRD_no"); 
                        String dburl = "jdbc:mysql://localhost:3306/db"; 

                        Class.forName("com.mysql.jdbc.Driver"); 
                        Connection con = DriverManager.getConnection(dburl, 
"usr", "password"); 
                        Statement stmt = con.createStatement(); 
                        ResultSet rs = stmt.executeQuery("SELECT 
v.visit_type AS 'visit_type', v.visit_code AS 'visit_code', " 
                                + "v.visit_date_time AS 
'visit_date_admission_date'," 
                                + " 
IF(v.visit_closed_yesno=1,'Closed','Open') AS 'visit_status'," 
                                + " pcm.description AS 
'visit_patient_category', v.id FROM visit v, " 
                                + "patient_category_master pcm WHERE 
DATE_FORMAT(v.visit_date_time,'%Y-%m-%d')" 
                                + " BETWEEN SUBDATE(NOW(),'201') AND NOW() 
AND v.patient_id='" + patMRD + "'AND v.patient_category_id=pcm.id;"); 

                        while (rs.next()) { 

                            String visit_type = rs.getString("visit_type"); 
                            String visit_code = rs.getString("visit_code"); 
                            String visit_date_admission_date = 
rs.getString("visit_date_admission_date"); 
                            String visit_status = 
rs.getString("visit_status"); 
                            String visit_patient_category = 
rs.getString("visit_patient_category"); 
                            String visit_id = rs.getString("id"); 
                %> 
                <tr> 
                    <td><%= visit_type%></td> 
                    <td><%= visit_code %></td> 
                    <td><%= visit_date_admission_date %></td> 
                    <td><%= visit_status %></td> 
                    <td><%= visit_patient_category %></td> 
                    <td><%= visit_id %></td> 
                    <td><input type="radio" name="visitID" value="<%= 
visit_id%>" /> 
                      <!--  <input type="submit" name="visitType" 
value="<%= visit_type%>"/> --> 
                        <input type="hidden" name="visitType" value="<%= 
visit_type%>" /> 
                </tr> 

                <% 
     } 
                    } catch (SQLException e) { 
                        e.printStackTrace(); 
                    } 
                %> 
            </table> 
            <table> 
                <tr> 
                    <td colspan="5"><input type="submit" value="Check Visit 
Details"/></td> 
                </tr> 
            </table> 
        </form> 

-- 
You received this message because you are subscribed to the Google Groups 
"JPassion.com: Web Programming Basics" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/jpassion_web/-/oBqk1fig8xoJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/jpassion_web?hl=en.

Reply via email to