Jump to content

[SOLVED] Creating an array where the key and value are the same


mapleleaf

Recommended Posts

So I need to create a drop down from an array and I want the name id and value to be the location.

My code below creates an array but by default the keys are assigned when i create the drop down. I want to assign the key as the the location too.

Any ideas?

$options = array();
foreach($query->result() as $row) {

		array_push($options, $row->location);
	}

 

Appreciated

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.