/    Sign up×
Community /Pin to ProfileBookmark

MTJ Function: Dynamic Dropdowns from any array

I have added another function to the MTJ library that I find myself using in EVERY application that I create because it’s so useful.

It takes an array of data (format: “value” => “displaytext” ) and create the dropdown in this format: <option value=”value”>displaytext</option> for each element in the array.

[b]Syntax:[/b]

string [b]make_dropdown[/b]( string select_name, array data [, mixed match, int size=1, bool multiple] )

[i]select_name[/i] – The name of the dropdown box to be used in the HTML.
[i]data[/i] – An array of data
[i]match[/i] – The value to match in the array to set this element to be selected in the dropdown.
[i]size[/i] – The size property of the dropdown.
[i]multiple[/i] – Is this dropdown a multiple select box?

[URL=http://www.mytechjournal.com/viewtopic.php?p=44#44]Read more and download this script here[/URL]

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@SpectreReturnsJun 03.2005 — It's nothing really new, and installing the function into every application you need it would be harder than just typing out the loop.
Copy linkTweet thisAlerts:
@chrysauthorJun 03.2005 — It's nothing really new, and installing the function into every application you need it would be harder than just typing out the loop.[/QUOTE]

Right...

require( "YourMainFunctions.php" );

There, now it's available. lol.
×

Success!

Help @chrys spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...