Home >Backend Development >PHP Tutorial >为什么option取出的是数字?

为什么option取出的是数字?

WBOY
WBOYOriginal
2016-06-06 20:34:201164browse

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

图片描述

<code><br>    <?php $sql = "select * from bigtype";
          $result = mysql_query( $sql );
    ?>

    <select style="width:200px;" name="bigtype[]" id="bigtype" onchange="changelocation(document.myform.bigtype.options[document.myform.bigtype.selectedIndex].value)" size="1">
        <option>请选择套餐</option>
        <?php while($rows=mysql_fetch_array($result)){?>
        <option value="<?php echo $rows['id']; ?>"><?php echo $rows['bigtype']; ?></option>
        <?php } ?>
    </select>


    <select style="width:100px;" class="trololo" name="smalltype[]" id="smalltype">
        <option>请选择小类</option>
    </select>

单价:<input style="display:inline-block;width:100px;" type="text" class="form-control" id="price_1" name="price[]" onchange="changecoat(1)">
数量:<input style="display:inline-block;width:100px;" type="text" class="form-control" id="count_1" name="quantity[]" onchange="changePrice(1)">
计价:<input style="display:inline-block; width:100px;" type="text" class="form-control" id="total_1" name="valuation[]" readonly>
<br>
</code>

回复内容:

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

图片描述

<code><br>    <?php $sql = "select * from bigtype";
          $result = mysql_query( $sql );
    ?>

    <select style="width:200px;" name="bigtype[]" id="bigtype" onchange="changelocation(document.myform.bigtype.options[document.myform.bigtype.selectedIndex].value)" size="1">
        <option>请选择套餐</option>
        <?php while($rows=mysql_fetch_array($result)){?>
        <option value="<?php echo $rows['id']; ?>"><?php echo $rows['bigtype']; ?></option>
        <?php } ?>
    </select>


    <select style="width:100px;" class="trololo" name="smalltype[]" id="smalltype">
        <option>请选择小类</option>
    </select>

单价:<input style="display:inline-block;width:100px;" type="text" class="form-control" id="price_1" name="price[]" onchange="changecoat(1)">
数量:<input style="display:inline-block;width:100px;" type="text" class="form-control" id="count_1" name="quantity[]" onchange="changePrice(1)">
计价:<input style="display:inline-block; width:100px;" type="text" class="form-control" id="total_1" name="valuation[]" readonly>
<br>
</code>

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

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn