I was trying to make a dropdown menu with dynamic contents from php elements in javascript, but when I click on the button add item, nothing happened. the elements from php is stored in $item[]
<script>
function addInput()
{
var table = document.getElementById("item");
var row = table.insertRow(0);
var cell1 = row.insertCell(0);
var cell2 = row.insertCell(1);
var cell3 = row.insertCell(2);
var cell4 = row.insertCell(3);
cell1.innerHTML = "<select name="i1[]">
<?php
echo "<option selected disabled>Choose Item Code</option>";
$i=0;
while(!empty($item[$i]))
{
echo "<option value=".$item[$i].">".$item[$i]."</option>";
$i++;
}
?></select>";
cell2.innerHTML = "<input type='text' name='q1[]' size=10>";
cell3.innerHTML = "<input type='text' name='p1[]' size=10>";
}
</script>
'<select name="i1[]">and then at the end:</select>';