When modifying a php form, how does one display the values in the multiple selection box including the selected and unselected values?

Source: Internet
Author: User
Tags php form
When modifying a php form, how does one display the values of multiple selection boxes including the selected and unselected php forms? when modifying a php form, you must first check the data from the database and display it, but how can I display the selected and unselected items in the multiple selection box! This is what I did when displaying the value queried from the database on the php modification page. I really don't know how to write it: & nbsp; echo & nbsp; & lt; td & nbsp; & gt; user Hobbies & lt; how to display the value of the multiple-choice box when modifying the td php form, including the selected and unselected
When modifying a php form, you need to first display the data from the database. but how can I display the selected and unselected data in multiple selection boxes! This is what I did when I display the value queried from the database on the php modification page. I really don't know how to write it: echo'User hobbies';
$ Newstring = "playing football, playing basketball, playing table tennis, and playing badminton ";
$ New = "playing football, playing table tennis, and playing badminton ";
$ One = "playing football and playing badminton ";
// $ Newarray = arrar ("playing football", "playing basketball", "playing table tennis", "playing badminton ");
// $ Len = strlen ($ resu ["hobbet"]);
$ String = $ resu ["hobbet"];
// Print_r ($ string); die ();
// Print_r (substr ($ string, 9, 21); die ();
If (strstr ($ newstring, $ string) = "playing football, playing basketball, playing table tennis, and playing badminton "){
If (substr ($ string, 9, 18) = "playing basketball "){
// Echo "jdljfl"; die ();
Echo' Play football Playing basketball Playing table tennis Playing Badminton';
} Else {
Echo' Play football Playing basketball Playing table tennis Playing Badminton';
}
} Elseif (strstr ($ newstring, $ string) = "playing basketball and table tennis "){
If (substr ($ string, 9, 21) = ""){
Echo' Play football Playing basketball Playing table tennis Playing Badminton';
} Else {
Echo' Play football Playing basketball Playing table tennis Playing Badminton';
}

} Elseif (strstr ($ newstring, $ string) = "playing table tennis and badminton "){
If (substr ($ string, 12, 24) = "playing badminton "){
Echo' Play football Playing basketball Playing table tennis Playing Badminton';
} Else {
Echo' Play football Playing basketball Playing table tennis Playing Badminton';
} Elseif (strstr ($ newstring, $ string) = "playing badminton "){
Echo' Play football Playing basketball Playing table tennis Playing Badminton';
} Else {
// Echo "woshishui"; die ();
Echo' Play football Playing basketball Playing table tennis Playing Badminton';
}
/* Switch ($ len ){
Case 3:
If (substr ($ resu ["hobbet"], 0, 1) = "kick "){
Echo' Play football Playing basketball Playing table tennis Playing Badminton';
} Else {
Echo' Play football Playing basketball Playing table tennis Playing Badminton';
}
}
Break;

Case 4:
Echo ""; break;
Default echo "1 ";*/

Echo'';
------ Solution ----------------------
Put all values into an array

The selected items can be found, and the remaining items are unselected.
------ Solution ----------------------
Okay, top of you

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.