|
|||
how about doing some function.
function trans_country($code) { switch ($code) { case "AF": $country = "Afghanistan"; break; case "MY": $country = "Malaysia"; break; // and so on.. default: $country = ""; break; }// end switch return $country; }// end trans_country function function return_option($code) { echo '<option value='.$code; echo "selected"; $country = trans_country($code); echo ' >'.$country; echo "</option>"; } Jadi bila run function return_option($code); should do it.. but the long translation of the country still needed.. hope this help.. r0kawa
__________________
<a href="http://www.php.net.my">www.php.net.my</a> Last edited by r0kawa; 06-04-2002 at 03:12 AM. |
|
|||
how about this...
lets say you wanna hv malaysia selected: $array['selected']['australia'] = ""; $array['selected']['indonesia'] = ""; $array['selected']['malaysia'] = ""; $array['selected']['thailand'] = ""; $array['selected']['singapore'] = ""; if(isset(my_country)){ $array['selected'][$my_country] = "selected"; } <select name="my_country"> <option value="australia" <? echo $array['selected']['australia']?>>Australia <option value="malaysia" <? echo $array['selected']['malaysia']?>>Malaysia <option value="yyy" <? echo $array['selected']['yyyy']?>>Malaysia <option value="xxx" <? echo $array['selected']['xxx']?>>XXX </select> genedavinci |
|
|||
i think the best away is to make your list of country name in a array... do a loop to initialize the $array['selected'][countryname'], if set $my_country, update your array with selected country, do a loop again to print out your entire list of country name.
hope this will help ![]() Last edited by genedavinci; 08-04-2002 at 04:26 PM. |
|
||||
OR, you could use a pre-written PHP class for displaying country select boxes. you can get a whole bunch of these kind classes (help u display forms) from this site:
http://phpclass.kiffer.idv.tw/browse.html/class/1.html here's some direct links to a few of the scripts: http://phpclass.kiffer.idv.tw/goto/b...ckage/129.html http://phpclass.kiffer.idv.tw/goto/b...ckage/406.html http://phpclass.kiffer.idv.tw/goto/b...package/5.html also, you'll need to know how to use classes in PHP in order to properly use these scripts. plus, to download the scripts, you'll need to register with the site, its free anyway. good luck. ![]() |
![]() |
«
Previous Thread
|
Next Thread
»
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| select 2 table | meiji | Website Programming | 5 | 02-02-2005 10:32 AM |
| select box/drop down menu | hymns | Website Design | 4 | 21-07-2004 04:24 PM |
All times are GMT +8. The time now is 07:55 AM.
Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.1.0 vBulletin skin by ForumMonkeys.com.
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.1.0 vBulletin skin by ForumMonkeys.com.













Linear Mode

