An in-depth discussion of the implementation of PHP dropdown box selection _php Tutorial

Source: Internet
Author: User
Realize

The first type of PHP drop-down box implementation method:

  1. < ? PHP
  2. Submit drop-down box;
  3. The result of a direct full trigger onchange event
  4. $ ID =$_get[' myselect ';//Myselect
    For the name of Location.herf?id;
  5. echo $id;
  6. The results submitted using the form;
  7. if ($_post["Sendselect"]) {//sendselect is the name of the form;
  8. $ Select_val =$_post["Selectid"];
  9. echo "The value you have chosen is: $select _val";
  10. }
  11. Print_r ($_post);
  12. $ Xing = "Xing" ;
  13. $ Fang = "Fang" ;
  14. Echo ' < a href=del_03. php? ID = '. $xing. '
    &action='. $fang. ' > FLX < /A > ';
  15. PHP, in the deletion of content, the wording of the hints given; The href must be appended with quotation marks;
  16. echo "n". " < input type=' button '
    value=' delete ' onclick= ' if (Confirm (' OK to delete '))
    { location.href='? delete= $result _manage[p_id] '} '>
  17. < br>< br>";
  18. }
  19. echo " < input type=' button ' value =' Connect_next '
    onclick = "Location.href = ' del_03.php?id=
    $xing &action= $fang '>';
  20. ?>

The second type of PHP drop-down box selection implementation method:

 
 
  1. < input type = "button" value = "Delete" onclick="
    if (Confirm (' OK to delete ')) location.href=
    ' del_03.php?id=xing '>< br/>
  2. < script language = "JavaScript" type = "Text/javascript">
  3. function Select (obj) {
  4. window.location.href = ' del_04.php?myselect=
    '+obj.options[obj.selectedindex].value;
  5. Return Can not write;
  6. }
  7. < /script >
  8. < input type = "button" value = "delete"
    onclick = "if (confirm (' OK to delete '))
    location.href= ' del_03.php?id=xing ' " > < br />
  9. < form name = "MyForm" action = "Del_04.php"
    Method = "POST" >
  10. < !--trigger The onchange event directly without submitting the form,-- >
  11. < !-- < Select name = "Selectid" onchange =
    "Location= ' del_04.php?myselect= ' +this.options
    [This.selectedindex].value]>-->
  12. < !--Write the onchange event in a function-- >
  13. < Select name = "Selectid" onchange = "SELECT (This)">
  14. < !-- < Select name="Selectid" > -->
  15. < option value = "0" > Please select < /option >
  16. < option value="value1"> Option1< /option>
  17. < option value="value2">option2 < /option>
  18. < option value="value3"> Option3< /option>
  19. < /select >
  20. < input type="Submit" name=" Sendselect "
    value = "Submit drop-down box" />
  21. < /form >

The above is the PHP drop-down box two implementation methods are introduced.


http://www.bkjia.com/PHPjc/445968.html www.bkjia.com true http://www.bkjia.com/PHPjc/445968.html techarticle Implementation of the first PHP drop-down box implementation method:? PHP//Submit drop-down box;//Direct full trigger onchange Event results $ id =$_get[' myselect '];//myselect for location.herf?id name; echo$ I ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.