⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

insert field_type dropdown how string



glotonfb

glotonfb
  • profile picture
  • Member

Posted 26 May 2014 - 02:06 AM

I so sorry, I can not write/speaking fine in English.

I have a cuestion.

 

$arr = array(
   'string 1',
   'string 2',
   'string 3'
);
$crud->field_type('col','dropdown',$arr);

It insert field how a number in my database, I would like with insert how string 1 or string 2 or string 3

 


Amit Shah

Amit Shah
  • profile picture
  • Member

Posted 26 May 2014 - 09:20 AM

welll

 

is this yr question - u want to store 1,2,3 instead of the text.. thn the answer is simple,... illustrated in the manual / doc center itself

$crud->field_type('status','dropdown',
array('1' => 'active', '2' => 'private','3' => 'spam' , '4' => 'deleted'));

u specify the index number as keys to the values...!!


glotonfb

glotonfb
  • profile picture
  • Member

Posted 31 May 2014 - 16:20 PM

welll

 

is this yr question - u want to store 1,2,3 instead of the text.. thn the answer is simple,... illustrated in the manual / doc center itself

$crud->field_type('status','dropdown',
array('1' => 'active', '2' => 'private','3' => 'spam' , '4' => 'deleted'));

u specify the index number as keys to the values...!!

 

On the contrary!

 

I want to store text instead of the 1,2,3.

 

Thanks Amit.


Amit Shah

Amit Shah
  • profile picture
  • Member

Posted 31 May 2014 - 19:35 PM

Well then i can set the key and value both to the same.. it will then store the text instead of number ... :)