请选择小类 单价:数量:计价:">
当前位置:Gxlcms > PHP教程 > 为什么option取出的是数字?

为什么option取出的是数字?

时间:2021-07-01 10:21:17 帮助过:3人阅读

我想让他插入到数据库是显示中文!
而不是显示数字1!
因该怎么改
图片描述

图片描述

  1. <code><br> <!--?php
  2. $sql = "select * from bigtype";
  3. $result = mysql_query( $sql );
  4. ?-->
  5. <select style="width:200px;" name="bigtype[]" id="bigtype" onchange="changelocation(document.myform.bigtype.options[document.myform.bigtype.selectedIndex].value)" size="1">
  6. <option>请选择套餐</option>
  7. <!--?php while($rows=mysql_fetch_array($result)){?-->
  8. <option value="<?php echo $rows['id']; ?>"><!--?php echo $rows['bigtype']; ?--></option>
  9. <!--?php } ?-->
  10. </select>
  11. <select style="width:100px;" class="trololo" name="smalltype[]" id="smalltype">
  12. <option>请选择小类</option>
  13. </select>
  14. 单价:<input style="display:inline-block;width:100px;" type="text" class="form-control" id="price_1" name="price[]" onchange="changecoat(1)">
  15. 数量:<input style="display:inline-block;width:100px;" type="text" class="form-control" id="count_1" name="quantity[]" onchange="changePrice(1)">
  16. 计价:<input style="display:inline-block; width:100px;" type="text" class="form-control" id="total_1" name="valuation[]" readonly="readonly">
  17. <br>
  18. </code>

回复内容:

我想让他插入到数据库是显示中文!
而不是显示数字1!
因该怎么改
图片描述

图片描述

  1. <code><br> <!--?php
  2. $sql = "select * from bigtype";
  3. $result = mysql_query( $sql );
  4. ?-->
  5. <select style="width:200px;" name="bigtype[]" id="bigtype" onchange="changelocation(document.myform.bigtype.options[document.myform.bigtype.selectedIndex].value)" size="1">
  6. <option>请选择套餐</option>
  7. <!--?php while($rows=mysql_fetch_array($result)){?-->
  8. <option value="<?php echo $rows['id']; ?>"><!--?php echo $rows['bigtype']; ?--></option>
  9. <!--?php } ?-->
  10. </select>
  11. <select style="width:100px;" class="trololo" name="smalltype[]" id="smalltype">
  12. <option>请选择小类</option>
  13. </select>
  14. 单价:<input style="display:inline-block;width:100px;" type="text" class="form-control" id="price_1" name="price[]" onchange="changecoat(1)">
  15. 数量:<input style="display:inline-block;width:100px;" type="text" class="form-control" id="count_1" name="quantity[]" onchange="changePrice(1)">
  16. 计价:<input style="display:inline-block; width:100px;" type="text" class="form-control" id="total_1" name="valuation[]" readonly="readonly">
  17. <br>
  18. </code>

1、你想要插入数据到到数据库,但是php执行的是select操作
2、如果optionvalue属性,则提交的是value值,没有则选项的值将设置为 标签中的内容。

人气教程排行