Presentation is loading. Please wait.

Presentation is loading. Please wait.

Select (drop-down list) Inputs. Insert/Form/List Menu.

Similar presentations


Presentation on theme: "Select (drop-down list) Inputs. Insert/Form/List Menu."— Presentation transcript:

1 Select (drop-down list) Inputs

2 Insert/Form/List Menu

3 Fill in dialog box

4 Right click on the drop-down list and select List Values Or just click on the List Values button in the Property Inspector

5 Add labels (shown) and values (hidden) and click the + button

6 Code View of Select (Drop-down list)

7 Simple select handler code

8 The value of the selected item is passed to the server

9 Using a switch statement to display different output based on user’s input

10 The switch statement A switch is a fancy version of an if used when there are several “cases” – various situations (sets of statements) that might be executed depending on the outcome of a single value. switch($session) In this case there are variations on the text printed based on the $session variable passed from the user using the POST method.

11 A case case "BB1_6_29": print " June 29, 10:00 - 12:00 "; print " Blackboard Introduction covers the basics to get one started. "; print " Location: Olney 200 "; break; Starts with the keyword case Followed by the value signaling that case Followed by the statements to be executed in this case Followed by the keyword “break” to denote the end of the case and prevent them from running into each other

12 Result

13 Another approach using a array

14 Arrays An array is a set of related variables – in this case the set of strings that might be printed. The individual elements of the array are specified by their index or key – It’s usually referred to as an index if you use a number, e.g. 0, 1, 2, … –It’s usually called a key if you use a string, e.g. ‘BB1_6_29’, as done here

15 Specifying an element print " You have chosen $session. $workshops[$session]"; In the statement above the code $workshops[$session] refers to the element of the array that has the key that was sent by the user in the POST method.


Download ppt "Select (drop-down list) Inputs. Insert/Form/List Menu."

Similar presentations


Ads by Google