Implementation of HTML inputable pull-down menu

Time:2020-1-16

Copy code

The code is as follows:

<html>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=UTF-8″ />
</head>
<body>
<?php
echo ‘
<form name=”DDForm” method=”GET” action=””>
<div style=”position:relative;”>
<span style=”margin-left:100px;width:18px;overflow:hidden;”>
<select style=”width:180px;margin-left:-100px” onchange=”this.parentNode.nextSibling.value=this.value” name=”hh”>
< option value = “car” > car < / option >
< option value = “train” > train < / option >
< option value = “aircraft” > aircraft < / option >
</select>
</span><input name=”box” style=”width:160px;position:absolute;left:0px;”>
< input value = “submit” name = “submit” type = “submit” / >
</div>
</form>’;
$AA = $_get [‘hh ‘]. “111”; / / value of select drop-down menu
$BB = $_get [‘box ‘]. “222”; / / enter the value of the box
echo $aa;
echo “</br>”;
echo $bb;
//To get the value of an input drop-down menu, simply get the value of the input box.
?>
</body>
</html>

 

To get the value of an input drop-down menu, simply get the value of the input box.

Note: < span > < input name = “box” style = “width: 160px; position: absolute; left: 0px;” >

This line should be in one line. It can’t be written

</span>

<input name=”box” style=”width:160px;position:absolute;left:0px;”>

After the line breaks, the value of the drop-down menu cannot be displayed in the input box.

Matching menu values can also be automatically selected based on the input.