emanuel_sb
08-09-2006, 04:36 AM
I am having problems with using List/Menu with php. Currently, I am using a form to post the language code value to mysql db. All this is fine, but since the list select language code value is different from the item label (full language name), when getting the information from the database, it displays the language code instead of the full language name.
The reason for this is because the list select has 2 values:
1 - Language code values (e.g. <option value=" en-gb">) which is to be sent to the database
2 - Full language name (e.g. English (United Kingdom)</option>) which is to be displayed on the browser
<select name="ch_language" id="ch_language">
<option value="<?php echo $channelRow[ch_language];?>" selected="selected"><?php echo $channelRow[ch_language];?></option>
<option value="af">Afrikaans</option>
<option value="sq ">Albanian</option>
<option value="eu">Basque</option>
<option value="be">Belarusian</option>
<option value="bg">Bulgarian</option>
<option value="ca">Catalan</option>
<option value="zh-cn">Chinese (Simplified)</option>
<option value="zh-tw">Chinese (Traditional)</option>
<option value="hr">Croatian</option>
<option value="cs">Czech</option>
</select>
I know where I have the problem on the code, but I am trying to find a way of assigning each language code to the full language name without having to use if statement for each language.
This is the line with the error, I mean the line which display what the values sent to the database.
<select name="ch_language" id="ch_language">
<option value="<?php echo $channelRow[ch_language];?>" selected="selected"><?php echo $channelRow[ch_language];?></option>
If anyone knows a way of making it work without having to use if statements for each select option, please let me know. And also if there is a simpler way of using if statements on this it would help……thanks
The reason for this is because the list select has 2 values:
1 - Language code values (e.g. <option value=" en-gb">) which is to be sent to the database
2 - Full language name (e.g. English (United Kingdom)</option>) which is to be displayed on the browser
<select name="ch_language" id="ch_language">
<option value="<?php echo $channelRow[ch_language];?>" selected="selected"><?php echo $channelRow[ch_language];?></option>
<option value="af">Afrikaans</option>
<option value="sq ">Albanian</option>
<option value="eu">Basque</option>
<option value="be">Belarusian</option>
<option value="bg">Bulgarian</option>
<option value="ca">Catalan</option>
<option value="zh-cn">Chinese (Simplified)</option>
<option value="zh-tw">Chinese (Traditional)</option>
<option value="hr">Croatian</option>
<option value="cs">Czech</option>
</select>
I know where I have the problem on the code, but I am trying to find a way of assigning each language code to the full language name without having to use if statement for each language.
This is the line with the error, I mean the line which display what the values sent to the database.
<select name="ch_language" id="ch_language">
<option value="<?php echo $channelRow[ch_language];?>" selected="selected"><?php echo $channelRow[ch_language];?></option>
If anyone knows a way of making it work without having to use if statements for each select option, please let me know. And also if there is a simpler way of using if statements on this it would help……thanks