Jump to content


insert field_type dropdown how string

insert field_type dropdown

  • Please log in to reply
3 replies to this topic

#1 glotonfb

glotonfb

    Newbie

  • Members
  • Pip
  • 4 posts

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

 



#2 Amit Shah

Amit Shah

    grocery CRUD Master

  • Advanced Member
  • PipPipPip
  • 1,192 posts
  • LocationMumbai, India

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...!!



#3 glotonfb

glotonfb

    Newbie

  • Members
  • Pip
  • 4 posts

Posted 31 May 2014 - 04: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.



#4 Amit Shah

Amit Shah

    grocery CRUD Master

  • Advanced Member
  • PipPipPip
  • 1,192 posts
  • LocationMumbai, India

Posted 31 May 2014 - 07:35 PM

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







0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users