hardikspider123 Posted June 16, 2015 Share Posted June 16, 2015 I have two drop down one is in form table and one is out side of table. if I want to update table coloumn(days) based on dropdown value(days) how would I do it? Please let me know if you need more description. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/296866-update-table-coloumn-based-o-dropdown-value/ Share on other sites More sharing options...
cyberRobot Posted June 16, 2015 Share Posted June 16, 2015 When you say table, do you mean HTML table? In other words, are you looking to change what an HTML tables displays based on the selection made in a drop-down menu? If that's the case, do you want the table to change instantly...or is it okay for the page to reload before showing the changes? If you want it to change instantly, you'll need to use a client-side language like JavaScript. Otherwise, you could use PHP to re-populate the HTML table. Quote Link to comment https://forums.phpfreaks.com/topic/296866-update-table-coloumn-based-o-dropdown-value/#findComment-1514118 Share on other sites More sharing options...
hardikspider123 Posted June 18, 2015 Author Share Posted June 18, 2015 Yes Html table and yes I am looking to change html tables display based on the selection made in drop down menu. and I want to do it instantly Quote Link to comment https://forums.phpfreaks.com/topic/296866-update-table-coloumn-based-o-dropdown-value/#findComment-1514273 Share on other sites More sharing options...
hardikspider123 Posted June 18, 2015 Author Share Posted June 18, 2015 --Add 30 Days--> <input id='button3' type='button' class='move' value='Add Days' /> <select id="daycombo1" class="mycombo1"> <option>SELECT</option> <option value="1">1</option> <option value="3">3</option> <option value="7">7</option> <option value="14">14</option> <option value="30">30</option> <option value="40">40</option> <option value="50">50</option> <option value="60">60</option> <option value="70">70</option> <option value="80">80</option> <option value="90">90</option> </select> This is dropdown and I want to enter days in html dropdown for all rows. here is my code for html table <script type="text/javascript"> //function getIt(){ //var i=$("#button3").val() //alert(i); //} $('#button3').click(function() { // $v1 = ($('#daycombo1').val()); // alert($v1); grabVal(); }); function grabVal() { $('.hovertable tbody tr').each(function () { var s = $(this).find('.mycombo input').val(); $('.mycombo1').find('option[value="' + s + '"]'); }) } $('#button1').click(function() { iterate(); }); $(".mycombo").change(function() { ($(this).find("option:selected").text()); }); function iterate() { var values = []; $("input:checkbox").each(function() { var $this = $(this); // console.log($this); var selected = {}; var $v = ""; var counter = 0; if ($this.is(":checked")) { $v = $this.closest("td").siblings("td") if ($v.find("select").attr("class") == "mycombo") { selected["memberid"] = $this.val(); selected['combo'] = $v.find("#combo :selected").text(); selected['daysadded'] = $v.find("#daycombo :selected").text(); } else { } values.push(selected); } else { } counter++; }); var dataArrayFields = {}; // dataArrayFields['command'] = 'forgotemail'; dataArrayFields['params'] = values; var ob = (JSON.stringify(values)); $.ajax({ type: "POST", url: "update3.php", data: {pData: ob}, // success: function(data2) { // whatToDo(data2); // // }, success: function() { alert("Records Updated Suceessfully"); location.reload(true); // $("#load").html(msg); }, cache: false }); } function whatToDo(status) { if (status == "success") { // echo "Record updated succesuufully"; location.reload(true); // // window.location = self; } else { } } $(document).ready(function() { $('.check:button').toggle(function() { $('input:checkbox').attr('checked', 'checked'); $(this).val('Uncheck All') }, function() { $('input:checkbox').removeAttr('checked'); $(this).val('Check All'); }) }) </script> Quote Link to comment https://forums.phpfreaks.com/topic/296866-update-table-coloumn-based-o-dropdown-value/#findComment-1514274 Share on other sites More sharing options...
hardikspider123 Posted June 22, 2015 Author Share Posted June 22, 2015 Can you please reply here Quote Link to comment https://forums.phpfreaks.com/topic/296866-update-table-coloumn-based-o-dropdown-value/#findComment-1514613 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.