Whi*_*ger 0 html php select option
我在这里得到了我的选择选项:
<tr>
<td><b>Categoria: </b></td>
<td>
<select style="width: 155px;">
<option value="Desktop">Desktop</option>
<option value="Portatil">Portátil</option>
<option value="Periferico">Periférico</option>
<option value="Tablet">Tablet</option>
</select>
</td>
</tr>
Run Code Online (Sandbox Code Playgroud)
我希望,在提交表单时,将选定的值转换为php中的变量,就像这个示例:
$password=$_POST['password']; /* example of what I'm doing at the beggining of the .php file.
Run Code Online (Sandbox Code Playgroud)
而且我不知道该怎么做.我不知道语法是如何将所选选项带到我想要的变量.
<select style="width: 155px;" name="device">
<option value="Desktop">Desktop</option>
<option value="Portatil">Portátil</option>
<option value="Periferico">Periférico</option>
<option value="Tablet">Tablet</option>
</select>
Run Code Online (Sandbox Code Playgroud)
添加名称到选择字段,它将作为 $_POST['device']