I have multiple checkboxes displayed from the MySQL table. I & lt; Div & gt; I'm trying to use
. Currently, my code is only for one checked value to be AJAX
from & lt; Div & gt; Sends to
. I have a & lt; Div & gt; I want to display all checked values in
.
What's so far away from me:
& Lt ;! - Display all checkboxes in the MySQL table, pass IDs from the name attribute - & gt; & Lt ;? Php}? & Gt;
AJAX
& lt; Script & gt; Function showPrice (name) {$ .ajax ({url: 'ajax_price.php', type: 'GET', data: {option: name}, success: function (data) {document.getElementById ('c'). InnerHTML = data;}}); } & Lt; / Script & gt; Include
ajax_price.php
& php ("../supplier/DB/db.php"); $ Id = $ _REQUEST ['Options']; & Lt ;? Php $ sql = "SELECT * FROM option WHERE op_id = '". $ Id "'"; $ Result = mysql_query ($ sql); While ($ line = mysql_fetch_array ($ result)) {? & Gt; & Lt; Div class = "oder" & gt; & Lt; Div class = "odercol2" & gt; & Lt ;? Php echo $ line ['op']; ? & Gt; & Lt; / Div & gt; & Lt; Div class = "odercol3" & gt; & Lt ;? Php echo $ line ['value']; ? & Gt; & Lt; / Div & gt; & Lt; / Div & gt; & Lt ;? Php}? & Gt; This & lt; Div & gt;
has a display with only one checked value. I see my and : //i.stack.imgur.com/lRINm.jpg "alt =" checkbox "> display the results in this division
Just change your AAAGF function to insert the internal HTML of the DIV, like: & lt; script & gt; function showPrice (name) {$ .ajax ({url: 'ajax_price.php', type: 'GET', data: {option: name}, success: function (data) {document .getElementById ('c'). InnerHTML + = Data;}}}} Note this line document.getElementById ('c'). InnerHTML + Data;
Hope this will work thanks
No comments:
Post a Comment