Jump to content

Recommended Posts

Posted

I have a PHP array which is populated from a MySQL database, in this case it's a list of countries - the countries ISO numeric identifier and the name.

 

The PHP Array populates fine and it outputs into a select list (using the Zebra Form PHP/JQuery class: Zebra_Form, a jQuery augmented PHP library for creating and validating HTML forms) and this is where the issue starts:

 

The select list populates with the isonum's and countries as expected, however also displays the array numeric identifier at the top (which looks bad and also breaks the ability to type search the options):

 

-select-

0

Afghanistan

Aland Islands

 

I did an array_splice($dataArray,0) which hides the 0 but caused a knock on issue - the select field was populated with options but countries ended up with rewritten key values so no longer were $_POST'ing their correct isonum's. Can anyone point me in the direction of a method to hide the 0 and maintain the correct isonum values for each country?

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...