I Create cookies by Js and i get the value by php $_COOKIE[ItemsName] so I can filter the model Items by items name the problem next row the cookies not update the value
here is my code
function GetDX2(Z)
{
// onchange items id ="Items_"+Z
//document.getElementById("Items_"+Z).value
//.innerHTML
var x =document.getElementById("Items_"+Z).value;
document.cookie="ItemsName="+x+";";
document.getElementById("ModelList").innerHTML="<?php $sql="select * from products where warehouseID='$_POST[currentchanged]' and Items='$_COOKIE[ItemsName]'"; $dd=mysql_query($sql,$conn); while($row=mysql_fetch_array($dd)){echo "<option value='$row[Model]'> $row[Items]</option>";} setcookie("ItemsName", "$_COOKIE[ItemsName]", "1/1/2003");?>";
}
here the input jquery
function addRow() {
$('table#myTable').dataTable().fnAddData( [
'<center><input type="text" name="sn_' + count + '" style="border-style: solid; border-width: thin; width: 20px" value="'+ccx+'"> <input type="hidden" name="SNX" style="border-style: solid; border-width: thin; width: 20px" value="'+count+'"></center>',
'<center><select name="warehouse_' + count + '" id="warehouse_' + count + '" style="border-style: solid; border-width: thin; width: 200px" onchange="GetWARE(' + count + ')"><?php $sql="select * from warehouselist"; $d=mysql_query($sql,$conn); if($_POST["currentchanged"]!=""){echo "<option>$_POST[currentchanged]</option>";} while($row=mysql_fetch_array($d)){echo "<option>$row[Name]</option>";} ?></select>',
'<center><input type="text" name="Items_' + count + '" id="Items_' + count + '" style="border-style: solid; border-width: thin; width: 300px" list="ItemsList" autocomplete="off" onchange="GetDX2(' + count + ')">',
'<center><input type="text" name="ItemsM_' + count + '" style="border-style: solid; border-width: thin; width: 200px" autocomplete="off" list="ModelList">',
'<center><input type="text" name="Des_' + count + '" style="border-style: solid; border-width: thin; width: 390px">',
'<center><input type="text" name="Qty_' + count + '" id="Qty_' + count + '" style="border-style: solid; border-width: thin; width: 50px" value="1" onchange="PricC(' + count + ')">',
'<center><input type="text" name="Price_' + count + '" id="Price_' + count + '" style="border-style: solid; border-width: thin; width: 50px" onchange="PricC(' + count + ')">',
'<center><input type="text" name="Total_' + count + '" id="Total_' + count + '" style="border-style: solid; border-width: thin; width: 50px">' ] );
count++;
ccx++;
document.getElementById("LOOPN").value= count;
}