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

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

<hr/>";
}