+ Post New Thread
Results 1 to 2 of 2
Coding Thread, PHP Array in Coding and Web Development; I have a PHP array which is populated from a MySQL database, in this case it's a list of countries ...
  1. #1

    Join Date
    Apr 2010
    Posts
    8
    Thank Post
    4
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    PHP Array

    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?

  2. #2

    Join Date
    Apr 2010
    Posts
    8
    Thank Post
    4
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    Damnit, don't you just hate it when one more Google gives you the answer?

    PHP: array_slice - Manual

SHARE:
+ Post New Thread

Similar Threads

  1. PHP: Extracting data from a SQL generated array
    By BarryWAaMC in forum Coding
    Replies: 15
    Last Post: 27th March 2010, 07:27 PM
  2. [PHP] PHP Data Grid
    By monkeyx in forum Web Development
    Replies: 0
    Last Post: 6th October 2009, 10:35 AM
  3. [PHP] MRBS config.inc.php
    By adminray in forum Web Development
    Replies: 3
    Last Post: 1st May 2009, 12:20 PM
  4. [PHP] MRBS config.inc.php
    By adminray in forum Web Development
    Replies: 2
    Last Post: 1st May 2009, 10:11 AM
  5. [PHP] PHP Form Generator
    By _Bat_ in forum Web Development
    Replies: 1
    Last Post: 25th March 2009, 11:39 AM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •