ユーザーがデータに必要な場合にフォームにフィールドを追加できるフォームを作成しています。
テキストボックスの行と1つのプルダウンフィールドを作成するアクションボタンによってトリガーされるjavascript関数を使用しています。
ただし、その行では、「はい」と「いいえ」のオプションを使用してプルダウンする必要があります。$success という名前の php 配列変数に既にそれらがあります。
これは私が試してプルダウンを作成しなければならないものですが、うまくいきません。
ta[n]=document.createElement('option');
ta[n].value = <?php echo $success; ?>;
ta[n].name='success'+n;
誰かが私を助けてくれませんか :)
これは現在のコードの大部分です
if(inp[c].value=='add')
{
inp[c].onclick=function()
{
ta[n]=document.createElement('input');
ta[n].setAttribute('rows',1);
ta[n].setAttribute('cols',20);
ta[n].name='time'+n;
document.getElementById('txtara').appendChild(ta[n])
ta[n]=document.createElement('input');
ta[n].setAttribute('rows',1);
ta[n].setAttribute('cols',20);
ta[n].name='event'+n;
document.getElementById('txtara').appendChild(ta[n])
ta[n]=document.createElement('input');
ta[n].setAttribute('rows',1);
ta[n].setAttribute('cols',20);
ta[n].name='supplies'+n;
document.getElementById('txtara').appendChild(ta[n])
var sel = document.createElement('select');