如何将正确的html选择值传递给$ _POST php [英] How to pass correct html select value to $_POST php

查看:125
本文介绍了如何将正确的html选择值传递给$ _POST php的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



 < form method =post> 
< select id =selectsize =2>
< option value =3> test< / option>
< option value =4> test2< / option>
< / select>
< button type =submitvalue =execute>
< / form>

我如何在post数组中获得3或4的值

  $ _ POST ['select'] 



<
$ div

$ $ p $ $ p> < select id =selectname =selectsize =2>


I have tried html like this:

<form method="post">
   <select id="select" size="2 ">
        <option value="3">test</option>
        <option value="4">test2</option>                     
   </select>
   <button type="submit" value="execute">
</form>

How do I get a 3 or 4 value in the post array

$_POST['select']

?

解决方案

Add the name tag...

<select id="select" name="select" size="2 ">

这篇关于如何将正确的html选择值传递给$ _POST php的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆