Home  >  Article  >  Backend Development  >  php gets the value selected by select

php gets the value selected by select

(*-*)浩
(*-*)浩Original
2019-09-07 14:39:1210217browse

php gets the value selected by select

php drop-down menu radio selection

Give the name attribute of the 221f08282418e2996498697df914ce4e tag a value, Use $_GET after the form is submitted ["name attribute value"] or $_POST["name attribute value"] can obtain the value of the selected item in the select drop-down menu.

Example: (Recommended learning: PHP programming from entry to proficiency)

<body align="center">
<form action="" method="post">
<select name="sel">
<option value="">请选择</option>
<option value="中国">中国</option>
<option value="美国">美国</option>
<option value="英国">英国</option>
</select>
<input type="submit" value="提交">
</form>
</form><br/><br/>
<?php
if($_POST){
echo $_POST["sel"];
}
?>
</body>

The above is the detailed content of php gets the value selected by select. For more information, please follow other related articles on the PHP Chinese website!

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