I have an array $texts which looks like this:
Array
(
[CAR_SINGULAR] => Array
(
[id] => 1
[translations] => Array
(
[de] => Auto
[en] => Car
)
)
[CAR_PLURAL] => Array
(
[id] => 2
[translations] => Array
(
[de] => Autos
[en] => cars
)
)
)
and then I have this piece of PHP code where I want to output the array with a simple h1 and an input type text for each of the translation country codes.
foreach(array_keys($texts) as $text)
{
echo "<h1>". $text ."</h1>";
foreach($texts[$text] as $textData)
{
foreach(array_keys($textData) as $languageCode)
{
echo $languageCode .": <input type=\"text\" id=\"". $ID_OF_CODE_AND_TEXTID ."\" value=\"". $VALUE_OF_LANGUAGE_CODE ."\" /><br />";
}
}
}
The result should be-
<h1>CAR_SINGULAR</h1>
de: <input type="text" id="de_1" value="Auto" /><br />
en: <input type="text" id="en_1" value="car" />
<h1>CAR_PLURAL</h1>
de: <input type="text" id="de_2" value="Autos" /><br />
en: <input type="text" id="en_2" value="cars" />
but somehow I am too blind to add the id and the value to the input :-(
Any help would be appreciated :-)
foreach(array_keys($textData) as $languageCode => $translation)echo $translation .": <input type=\"text\" value=\"". $textData[$translation] ."\" /><br />";