douzhenggui8171 2013-06-28 08:40
浏览 388
已采纳

使用$ _POST获取<option>的值会给出文本

So, I'm retrieving these options from a database

select and options

and I need to retrieve the value but I'm getting the text in between the tags

<option></option>

by doing this

$inst = $_POST['inst'];

therefore if I print $inst I get the "IUTIRLA" for the first option but I need the 41

I don't know what I'm doing wrong... this is how I'm printing the html through php

echo "<option value=".$cod_institucion.">".$nombre_institucion."</option>";
  • 写回答

4条回答 默认 最新

  • dongyanju1094 2013-06-28 08:46
    关注

    here you need to correct php code, as it is not parsing the values properly. Put values under quotes.

    echo "<option value='".$cod_institucion."'>".$nombre_institucion."</option>";
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)
编辑
预览

报告相同问题?

手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部