<?php
if (isset($_POST['language'])) $language = addslashes(trim(strip_tags(stripslashes($_POST['language']))));
else {
	if (isset($_GET['language'])) $language = addslashes(trim(strip_tags(stripslashes($_GET['language']))));
	else $language = NULL;
}

if (isset($c_languages) && $c_languages){
	print "
<div class='form-row'>
	<label for='language' class='form-label'>".LABEL_LANGUAGE."</label>
	<div class='form-cols'>
		<div class='form-col form-medium'>
			<div class='form-controls'>
				<select class='select reload' name='language' id='language'>";
	$sql_tmp = "SELECT * FROM languages ORDER BY sortorder ASC";
	$result_tmp = $conn->prepare($sql_tmp);
	$result_tmp->execute();
	print "<option value=''>...</option>";
	while ($arr_tmp = $result_tmp->fetch()){
		if ($language == $arr_tmp['iso']){
			print "<option value='".$arr_tmp['iso']."' selected='selected'>".id($arr_tmp['label'])."</option>";
		} else print "<option value='".$arr_tmp['iso']."'>".id($arr_tmp['label'])."</option>";
	}
	print "
				</select>
			</div><!-- /.form-controls -->
		</div><!-- /.form-col -->
	</div><!-- /.form-cols -->
</div><!-- /.form-row -->

<hr/>";
}