html select以数组的方式提交

  • Post author:
  • Post category:其他


1).select 以数组的方式提交


<form>

<input type=”hidden” name=”app” value=”wap_test”>

<select


name=”attribute[颜色]”


>

<option value=”红色”>红色</option>

<option value=”黄色”>黄色</option>

<option value=”蓝色”>蓝色</option>

</select>

<select


name=”attribute[形状]”


>

<option value=”圆形”>圆形</option>

<option value=”正方形”>正方形</option>

<option value=”三角形”>三角形</option>

</select>

<input type=”submit” name=”submit” value=”提交”>

</form>

var_dump($_GET[‘attribute’]);结果是:


array

‘颜色’ => string ‘红色’ (length=6)

‘形状’ => string ‘圆形’ (length=6)

2).input 以数组的方式提交

<form action=”<?php echo ConfigNovo::LOCAL_URL?>/mydemo1/weixin/estfinance.php”>


<input type = “text” name = “receiver[0]” value = “aa”/>

<input type = “text” name = “receiver[1]” value = “bb”/>

<input type = “text” name = “receiver[2]” value = “cc”/>


<input type = “hidden” name = “method” value = “unifiedSend”/>

<button class = “tijiao” type = “submit”>统一发送</button>

</form>

后台PHP接收结果:

$receiver = $GLOBALS[‘params’][‘receiver’];

表单参数:$receiver=

Array

(

[0] => aa

[1] => bb

[2] => cc

)

转载博客:

http://blog.sina.com.cn/s/blog_a51dfb960101jwx1.html


转载于:https://my.oschina.net/qimhkaiyuan/blog/823946