I am trying to return each description the user has posted for each language the site supports that is active.
I have the data posting into the database ok but there is a function I need, for validating, if the user has disabled there javascript on there browser.
This piece of code checks which languages are active on the site.
/* Detect active languages on the site. */
$qLang = mysql_query("SELECT * FROM languages WHERE `is_active`='Y'") or die("ERROR: ".mysql_error());
while($languages = mysql_fetch_array($qLang)){
$Lang = array($languages['lang_code'] => $languages['lang_code']);
$lang = $Lang[$languages['lang_code']];
$description[$lang] = mysql_real_escape_string($_POST['description_'.$lang.'']);
$convert = array("\r\n", "\n", "\r", " "); /* Remove bad code to a friendly text */
$replace = " "; /* Don't replace anything just leave it blank to remove bad content. */
$description[$lang] = str_replace($convert, $replace, $_POST['description_'.$lang.'']); /* Processes \r\n's first so they aren't converted twice. */
$description[$lang] = strip_tags($description[$lang]," "); /* Removes any HTML Tags. */
if(!empty($description[$lang])){ $addDescription[$lang] = "description_$lang=$description[$lang]&"; } /* If user input for description is not empty then description in that language will be added. */
}
The top part works for the other functions in my script, but this bottom piece of code does not.
foreach($Lang as $languages['lang_code'] => $description[$lang]){
$addDescription = $addDescription[$lang];
}
I only get 1 of them returning whether or not the user has entered a description for another language.
I looks like this when it is echoed: description_en=description text goes here&
I need it to be able to echo more than one for each language the site has provided like so: description_en=description text goes here&description_fr=texte de la description va ici&
If any one can help me figure this out I would mostly appreciate it.
Finding it funny that MS is urging IT admins as if this was a big, significant update. No new features, just an enablement package that will bump up the build number again, which is a shame considering 22H2 and 24H2 were significant updates. Technically, 25H2, 26H1, and the upcoming 26H2 are all the same with different support schedules. They could've ship the Windows K2 improvements in this update but they chose not to.
The era of Windows being in the backburner continues, and this 26H2 update feels like an afterthought. Shame Nadella, shame.
After I installed those, my older but capable Win 11 laptop (16GB RAM) reported it as 26H2 26300.8697.
Then I installed it on my big laptop (128GB RAM! Hehe sorry), it reported it as 25H2 26220.8690. Ugh. Do I have to switch Insiders channels from Release to Beta?
Question
seb86
I am trying to return each description the user has posted for each language the site supports that is active.
I have the data posting into the database ok but there is a function I need, for validating, if the user has disabled there javascript on there browser.
This piece of code checks which languages are active on the site.
/* Detect active languages on the site. */ $qLang = mysql_query("SELECT * FROM languages WHERE `is_active`='Y'") or die("ERROR: ".mysql_error()); while($languages = mysql_fetch_array($qLang)){ $Lang = array($languages['lang_code'] => $languages['lang_code']); $lang = $Lang[$languages['lang_code']]; $description[$lang] = mysql_real_escape_string($_POST['description_'.$lang.'']); $convert = array("\r\n", "\n", "\r", " "); /* Remove bad code to a friendly text */ $replace = " "; /* Don't replace anything just leave it blank to remove bad content. */ $description[$lang] = str_replace($convert, $replace, $_POST['description_'.$lang.'']); /* Processes \r\n's first so they aren't converted twice. */ $description[$lang] = strip_tags($description[$lang]," "); /* Removes any HTML Tags. */ if(!empty($description[$lang])){ $addDescription[$lang] = "description_$lang=$description[$lang]&"; } /* If user input for description is not empty then description in that language will be added. */ }The top part works for the other functions in my script, but this bottom piece of code does not.
foreach($Lang as $languages['lang_code'] => $description[$lang]){ $addDescription = $addDescription[$lang]; }I only get 1 of them returning whether or not the user has entered a description for another language.
I looks like this when it is echoed: description_en=description text goes here&
I need it to be able to echo more than one for each language the site has provided like so: description_en=description text goes here&description_fr=texte de la description va ici&
If any one can help me figure this out I would mostly appreciate it.
Thank you.
Link to comment
https://www.neowin.net/forum/topic/925504-foreach-language-add-value/Share on other sites
5 answers to this question
Recommended Posts