function state_selection() { echo '<select name="state">'; $states = array( 'Alabama', 'Alaska', 'Arizona', 'Arkansas', 'California', 'Colorado', 'Connecticut', 'Delaware', 'District of Columbia', 'Florida', 'Georgia', 'Hawaii', 'Idaho', 'Illinois', 'Indiana', 'Iowa', 'Kansas', 'Kentucky', 'Louisiana', 'Maine', 'Maryland', 'Massachusetts', 'Michigan', 'Minnesota', 'Mississippi', 'Missouri', 'Montana', 'Nebraska', 'Nevada', 'New Hampshire', 'New Jersey', 'New Mexico', 'New York', 'North Carolina', 'North Dakota', 'Ohio', 'Oklahoma', 'Oregon', 'Pennsylvania', 'Rhode Island', 'South Carolina', 'South Dakota', 'Tennessee', 'Texas', 'Utah', 'Vermont', 'Virginia', 'Washington', 'West Virginia', 'Wisconsin', 'Wyoming' ); foreach ($states as $state_name) { echo '<option value="'.$state_name.'">'.$state_name.'</option>'; } echo '</select>'; } state_selection();
Never been to CodeSnippets before?
Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)
PHP State-Array Generator (See related posts)
You need to create an account or log in to post comments to this site.
Related Posts
» Selecting and checking items... in php xhtml html form select option radio checkbox selection persistent
» Clear form with Javascript in xhtml html javascript firefox clear form msie valid
» HTML tag stripper in php html strip strip_tags
» HTML Form Values - Select Co... in html form iso geography
» HTML Form Values - Select U.... in html form iso geography
» Close dangling HTML tags in php html tidy
Snippets (source code soon to be available) developed by Peter Cooper and powered by Ruby On Rails