PHP gets the form value--Gets the value and text values of the Drop-down box at the same time ____php

Source: Internet
Author: User
The solution to get the value and text values of the dropdown box at the same time:
Add a <p> tag, the user selects an item and then assigns the item's text to him

Then accept the page to get the P variance to get the corresponding text value

Form Fill page:

<form action= "submit.php" method= "POST" > <div> <label for= "Workyear" > Working life <em>*</em> &L t;/label> <select name= "workyear" class= "weight190" id= "Workyear" > <option value= "0" >---Please select---</op Tion><option value=1> students </option><option value=2> Fresh graduates </option><option More than one year </option><option value=4> more than two years </option><option value=5> more than three years </option><option                      
	Value=6> more than five years </option><option value=7> more than eight years </option><option value=8> more than ten years </OPTION> </select> <p class= "note" name= "Workyear_note" id= "Workyear_note" ></p> </div> </ Form> <script> $ ("#workYear"). Change (function () {        //code ...  
       var workyear_note=$ ("#workYear"). Find ("option:selected"). Text ();
        $ ("#workYear_note"). Text (workyear_note);     });
 </script>




PHP Get page submit.php:

       $infobean-> Workindustryid = $_post[' workyear '];
	$infobean-> workindustryname = $_post[' workyear_note '];

This is easy + successful resolution of the problem.


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.