In cakephp3.6.7 in gender storing as 1 in db while fetching also show 1 i want 1 to show male while showing page after fetching

while fetch multiple checkbox value from database it stored like (1,3) in database, but while fetching is not showing using implode and explode functions in cakephp3.6.7 plz help me


Hi Darshan,

Please can you share more information with us - what you’ve tried would be a great start!

CakePHP Community manager

see actually in radio button gender storing 1 as male and 2 as female in database and while fetching also showing 1 or 2 right…?

if 1 means how to print male while fetching

Maybe you can write simple array variable store

<?php $gender= ['1' => 'Male', '2' => 'Female'];
echo $gender[$user->gender];

OR you can create Helper function pass parameter gender value and return string Male/Female

thanks bro…

very usefull…:ok_hand::ok_hand::ok_hand::ok_hand::ok_hand::ok_hand: