Home > Backend Development > PHP Tutorial > How to use an array to fill a drop-down list box in PHP_PHP Tutorial

How to use an array to fill a drop-down list box in PHP_PHP Tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-13 09:58:35
Original
1089 people have browsed it

How PHP uses an array to fill a drop-down list box

This example describes how PHP uses an array to fill a drop-down list box. Share it with everyone for your reference. The specific implementation method is as follows:

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

$data = array(

(object)array("titulo"=>"Ford", "valor"=>"opcion1"),

(object)array("titulo"=>"Peugeot", "valor"=>"opcion2"),

(object)array("titulo"=>"Chevrolet", "valor"=>"opcion3"),

(object)array("titulo"=>"Volskwagen", "valor"=>"opcion4"),

);

?>

<script></p> <p>function onCambioDeOpcion(combobox) {</p> <p>alert("Seleccionaste: " combobox[combobox.selectedIndex].text </p> <p>" nSu valor es: " combobox.value);</p> <p>}</p> <p></script>

1 2 3

4

6 7 8 9 10
11 12
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
<🎜>$data = array(<🎜> <🎜>(object)array("titulo"=>"Ford", "valor"=>"opcion1"), (object)array("titulo"=>"Peugeot", "valor"=>"opcion2"), (object)array("titulo"=>"Chevrolet", "valor"=>"opcion3"), (object)array("titulo"=>"Volskwagen", "valor"=>"opcion4"), ); ?>
<script> function onCambioDeOpcion(combobox) { alert("Seleccionaste: " combobox[combobox.selectedIndex].text " nSu valor es: " combobox.value); } </script>
http://www.bkjia.com/PHPjc/977161.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/977161.htmlTechArticleHow to use an array to fill a drop-down list box in PHP. This example describes how to use an array to fill a drop-down list box in PHP. Share it with everyone for your reference. The specific implementation method is as follows: 1 2...
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
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template