Avatar of Eduardo Fuerte
Eduardo Fuerte
Flag for Brazil asked on

How to make an array to accept the first value to be presented in a combobox?

Hi Experts

Having this code

 function get_orgao($idprograma = 0) 
  {
	// Select your records
    	$this->db->select('idorgao, nome');
        $this->db->from('tb_orgao');
        $this->db->order_by('nome');
        $this->db->where('idprograma', $idprograma);
		
	   // Get the results 
	   $results = $this->db->get()->result_array();

	   // Add the SELECT item to the start of the array
    	array_unshift($results, array('id' => '0', 'name' => 'SELECT'));

	   return $results;
    }

Open in new window


What must be needed to make the combo presents  
- SELECT -
as the 1st line of the combo instead of undefined

img001
Thanks in advance!
PHPjQueryJavaScriptJSONAJAX

Avatar of undefined
Last Comment
Eduardo Fuerte

8/22/2022 - Mon
Rainer Jeschor

Hi,
what does the PHP function generate and how is that incorporated to the page?
Could you post the resulting HTML source (not the PHP source)?
How is that dropdown filled? By HTML source or via JavaScript?

Thanks.
Rainer
ASKER CERTIFIED SOLUTION
Chris Stanyon

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Eduardo Fuerte

ASKER
Perfect!

Thank you very much.
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23