如何在< select>中获得全部价值

如何在< select>中获得全部价值

问题描述:

示例

< select name = username>

< option value = Borneo Sabah> Borneo Sabah< / option>

&lt ; / select>

Hot get / show Borneo Sabah not Borneo

example
<select name=username>
<option value=Borneo Sabah>Borneo Sabah</option>
</select>
Hot get/show Borneo Sabah not Borneo

放入婆罗洲沙巴内部报价:

Put Borneo Sabah inside quotes:
<select name=username>
<option value="Borneo Sabah">Borneo Sabah</option>
</select>



HTML中不需要围绕属性值的引号,但在某些情况下它们是必需的,例如当你必须在属性值中放置一个空格。




Quotes around an attribute value are not required in HTML, but they are necessary in some cases such as when you have to put a space inside your attribute value.

不带引号的属性值也必须不包含以下任何字符:



,',=,>,<或`。当然,你可以有%,或者#或£,但是没有反引号!

Unquoted attribute values must also not contain any of these characters:

", ', =, >, <, or `. Sure, you can have %, or # or £, but no backticks please!





如果你想从PHP设置属性值,你必须逃避报价 [ ^ ](使用 \):



If you want to do set the attribute value from PHP, you have to escape the quote[^] (using \"):

echo"<option value=\"".


rows [0]。 \>
rows[0]."\">".


rows [0]。 < / option>;
rows[0]."</option>";