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.
Neowin says it's $39.99, but their site says $399.99 after discount. Is Neowin covering the difference? I'll take 7 if they are. Not 8, not 6, never 5, but 7.
Yeah and now they added space above the tab bar, so now I have to painstakingly aim at just slightly below the top of the screen to reach a tab with my mouse.
truly hate it
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