The combined use of Javascript and select components in php

WBOY
Release: 2016-08-08 09:34:04
Original
875 people have browsed it


//Combined use of javascript and select components
//In the process of writing the program, I want to realize that after selecting the option in the select object,
//No need to submit button, but trigger the action directly, and after the action occurs
//The selected options should be kept on the page. After describing it, I finally passed it
//Use Javascript and the onchange attribute of the select object and
//value value realizes this function.
//The code is as follows (the file name is "test.php"):


switch ($mon){
case '': echo 'Please select your zodiac sign:';break;
case '1':echo 'Your zodiac sign is Aquarius';break;
Case '2':echo 'Your zodiac sign is Pisces';break;
case '3':echo 'Your zodiac sign is Aries';break;
case '4':echo 'Your zodiac sign is Taurus';break;
case '5':echo 'Your zodiac sign is Gemini';break;
case '6':echo 'Your zodiac sign is Cancer';break;
case '7':echo 'Your zodiac sign is Leo';break;
case '8':echo 'Your zodiac sign is Virgo';break;
case '9':echo 'Your zodiac sign is Libra';break;
case '10':echo 'Your zodiac sign is Scorpio';break;
case '11':echo 'Your zodiac sign is Sagittarius';break;
case '12':echo 'Your zodiac sign is Capricorn';break;
​​default:break;
}        
?>




​​​​​

The above introduces the combined use of Javascript and select components in PHP, including aspects of the content. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template