Thursday, 11 February 2016



you can use this code in the following cases:

1) if you want to save data on submitting form then,
replace onchange=“getSummary2(‘order’)” with onclick=“getSummary2(‘order’)”

2) if you want to save on key up then,
replace onchange=“getSummary2(‘order’)” with onKeyUp=“getSummary2(‘order’)”

3) if you want to save data on change then use the code as it is


---------------------------------------------html code-------------------------------------------------


----------------------------------------------------------------------------------------------------------
------------------------------------------javascript.js--------------------------------------------------
function getSummary2(pass)
{
var	id = document.getElementById("sp_order"+pass).value;
	//alert(pass);
   $.ajax({
     type: "GET",
     url: 'sp_orders.php',
     data: "order=" + id + "&&section_id=" + pass, 
// appears as $_GET['id'] @ your backend side
     success: function(data) {
           // data is ur summary
        //  $('#order').html(data);
		     }

   });

}

-------------------------------------------------------------------------------------------------------------
-----------------------------------------sp_orders.php---------------------------------------------------
include('connect.php');
 $timestamp_complete = date("Y-m-d");
 $order = $_GET['order'];
 $section_id = $_GET['section_id'];
 mysql_query(" UPDATE  d_o_sp_orders  SET status='0' 
WHERE section_id='$section_id'");
		
mysql_query(" INSERT INTO  table (`order_id`, `orders`,
 `section_id`, `status`, `status_timestamp`) VALUES 
(NULL, ' $order', '$section_id', '1', '$timestamp_complete')");

------------------------------------------------------------------------------------------------------------
                                                   

Sunday, 7 February 2016





You can generate unlimited textboxes and unlimited their sub-texboxes by using the below code..

HTML CODE


<input type='text' name=''></input> <input id='btnAdd' type='button' class='btn btn-primary' value='+' onclick='AddTextBox(".$duty_id[$x].")' />
<button onClick=\"toggle_visibility('watch');\">?</button> <div id='TextBoxContainer".$duty_id[$x]."'>
<!--Textboxes will be added here -->
</div>


 JAVASCRIPT CODE


function GetDynamicTextBox(value,id){
var counter='1';
return '<td></td><td><input name = "DynamicTextBox" type="text" value = "' + value + '" id="country'+ id +'" onkeyup="suggest(this.value,'+ id +')" /></td>' +
'<td><input type="button" value="-" class="btn btn-primary hide-print" id="rem_btn" onclick = "RemoveTextBox(this,'+ id +')" /></td>'

counter=counter + 1;
}

function AddTextBox(id) {
var div = document.createElement('DIV');
div.innerHTML = GetDynamicTextBox("",id);
document.getElementById("TextBoxContainer"+id).appendChild(div);
}

function RemoveTextBox(div,id) {
//alert(id);
document.getElementById("TextBoxContainer"+id).removeChild(div.parentNode);
}
For any query write me in comments or email me