开发者

How to save two different values from one dropdown selection

in the backend a user can select a country via dropdown menu, e.g. "Germany". The frontend is bilingual so i have to dump "Germany" if language A is set and "Deutschland" if language B is set.

How can i save the selection an开发者_高级运维d its translation to separate fields in the database?

Thank you for any help!


you can use a array where you save the multilingual query and pick the value you like to use. or use a id like

1 for germany,deutschland,etc 2 for usa,america etc 3 for uk,england etc

<--- name="contry" value="1"> Germany </>

or

<--- name="contry" value="1"> Deutsch </>


You can have a lookup value for the Name for each language. Once the selected value is retrieved, you can make a lookup. Otherwise, in the codebehind, get the SelectedItem and SelectedValue to get both of them.


Thanks, I did it as follows:

BACKEND:

<select name="country">
<option value="Deutschland:Germany">Deutschland</option>
<option value="Frankreich:France">Frankreich</option>
...
</select>

FRONTEND:

$countries = explode(':', $country);
$country_de = $countries[0];
$country_en = $countries[1];
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜