Implementation
The first PHP drop-down box implementation method:
- < ?php
- / /Submit drop-down box;
- //Directly trigger the result of onchange event
- $id=$_GET['myselect']; // myselect
is the name of location.herf?id; - echo $id;
- //Results submitted using the form;
- if($_POST["sendSelect"]){ //sendSelect is the name of the form;
- $select_val=$_POST["selectID"];
- echo "The value you selected is: $select_val";
- }
- // print_r($_POST);
- $xing="xing";
- $fang="fang" ;
- a href=del_03.php?id='.$xing.' &action='.$fang.'
>flx< /a>'; //In php, When deleting content, the prompt given is written; href must be followed by quotation marks; echo "n"."< -
- input type='button' value= 'Delete'
onclick="if(confirm('Confirm to delete ?')) { location.href='?delete=$result_manage[p_id]'}"
> < br - >< br>"; } echo "<
-
- input type='button' value='connect_next' onclick="location.href='del_03.php?id=
$xing&action=$fang'"> ;"; - ?> >The second implementation method of PHP drop-down box selection:
The above is an introduction to the two implementation methods of PHP drop-down box.
- < input type="button" value="delete" onclick="
if(confirm('确定要删除吗')) location.href=
'del_03.php?id=xing'">< br/>
-
< script language="JavaScript" type="text/javascript">
- function select(obj){
-
window.location.href='del_04.php?myselect=
'+obj.options[obj.selectedIndex].value;
- return; //可以不写;
- }
-
< /script>
-
< input type="button" value="delete"
onclick="if(confirm('确定要删除吗'))
location.href='del_03.php?id=xing'">< br/>
-
< form name="myform" action="del_04.php"
method="post">
-
< !-- 直接触发onchange 事件 ,此时不用提交表单,-- >
-
< !--< select name="selectID" onchange=
"location='del_04.php?myselect='+this.options
[this.selectedIndex].value">-->
-
< !-- 把onchange 的事件写在一个函数里面-- >
-
< select name="selectID" onchange="select(this)">
-
< !-- < select name="selectID" >-->
-
< option value="0">请选择< /option>
-
< option value="value1">option1< /option>
-
< option value="value2">option2< /option>
-
< option value="value3">option3< /option>
-
< /select>
-
< input type="submit" name="sendSelect"
value="提交下拉框"/>
-
< /form>
http://www.bkjia.com/PHPjc/445968.htmlwww.bkjia.com
true
http: //www.bkjia.com/PHPjc/445968.htmlTechArticleImplement the first PHP drop-down box implementation method: ?php //Submit the drop-down box; //Directly trigger onchange The result of the event $ id =$_GET['myselect'];//myselect is the name of location.herf?id; echo$i...