duan0414 2014-05-15 14:12
浏览 136

在表单中提交div中的<select>字段的值

i am trying to submit values of form.
but all values other than a <select> field is not submitted because i think its inside div element as shown in code below

<form action="next.php" method="post">
     <input>....
     <input>....
     <input>....
     <select name="asdf"> <!--This field submitted successfully -->
         <option value="wtevr"> </option>
         <option value="wtevr2"> </option>..........
     </select>
     <div>
         <select name="asdf2"> <!--problem is here submitting this field -->
             <option value="wtevr11"> </option>
             <option value="wtevr22"> </option>..........
         </select>
     </div>
</form>

I used div because this is part of my ajax code through which i update the values in select field.

Is there any alternative solution to submit this select field form?

MY approach:

I think that there is a solution if i use a hidden input field in this form whose value get equal to value of select field before submitted the form.

<input type="hidden" value="<!--comes from JavaScript code -->">

I am new to JavaScript so any help is appreciated..

  • 写回答

2条回答 默认 最新

  • doumeng9188 2014-05-15 14:19
    关注

    Use a 'name' tag in your inputs, then they'll be submitted. like this:

    <form action="next.php" method="post">
    <input name="foo" value="var"/>
    </form>
    
    评论

报告相同问题?

悬赏问题

  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料
  • ¥15 使用R语言marginaleffects包进行边际效应图绘制