代码之家  ›  专栏  ›  技术社区  ›  Dave

Html表单提交-未发送ajax生成的下拉列表值

  •  1
  • Dave  · 技术社区  · 16 年前

    Thnx公司

    <table border="0" width="600">
    <tr>
    <form name='form1' id='form1' method='get' action=''>
    <td width="80"><h4><b>Source 1:</b></h4></td>
    <td>
    <select name='host_selection' onChange="showDatet(this.value,'txtHint1')">
    {foreach from=$hostlist item="entry"}
    <option value={$entry.host}>{$entry.host}</option>
    {/foreach}
    </select>
    </td>
    <td>
    <div id="txtHint1">
    </div>
    </td>
    </tr>
    <tr>
    <td>
    <button type='submit' name='Submit'>COMPARE!</button>
    </td>
    <td>
    <input type='hidden' name='op' value='hid' />
    </td>
    </form>
    </tr>
    </table>
    

    通过ajax调用的部分php代码:

    echo "<select name='datet_selection" . $fieldID . "'>Test</option>";
    foreach ($x->sql->record as $temp) {
        echo "<option value='" . $temp['datet'] . "'>" . $temp['datet'] . "</option>";
    }
    echo "</select>";   
    
    2 回复  |  直到 16 年前
        1
  •  1
  •   Chris Van Opstal    16 年前

    这可能无法解决整个问题,但动态渲染的下拉列表似乎格式不正确。更改:

    echo "<select name='datet_selection" . $fieldID . "'>Test</option>";
    

    echo "<select name='datet_selection" . $fieldID . "'><option>Test</option>";
    
        2
  •  0
  •   Josh Curren    16 年前

    我想你还需要一个。。。所以你需要:

    echo "<select name='datet_selection" . $fieldID . "'><option>Test</option></select>";