mysql - PHP "else" and "if" on code for registration script -
i purchased script while ago (php/mysql) contains user registration form. script has area selection of gender (male or female). 2 options.
i want modify code allow selection of animal instead of sex. changed code in applicable places, , works great. problem is, displays animals 1 , 2, since initial code setup "male/female" selection (2).
i need find way code allow 15 animals instead of 2 results. here code. "profile_userinfo_gender1" , "gender2" call "gender" or "animal". should go "gender15". please help! thank you!
if ($d->u->gender == 0) $d->gender = $this->lang('profile_userinfo_withoutinfo'); else { if ($d->u->gender == 1) $d->gender = $this->lang('profile_userinfo_gender1'); else $d->gender = $this->lang('profile_userinfo_gender2'); }
if ($d->u->gender == 0) $d->gender = $this->lang('profile_userinfo_withoutinfo'); else { $total_gender = 15; //define total gender for($i = 1;$i <= $total_gender;$i++){ if ($d->u->gender == $i) $d->gender = $this->lang("profile_userinfo_gender$i"); } #add gender generic default. if ($d->u->gender == $i) $d->gender = $this->lang("profile_userinfo_gender_default"); }
Comments
Post a Comment