<?php
require($_SERVER['DOCUMENT_ROOT'].'/espace_personnel/inc/head-lib.php');

foreach($_POST as $key => $value){	
	if(isset($_POST[$key.'_type'])){
		$type = $_POST[$key.'_type'];

		if($type == 'upper_text')
			$data = strtoupper($_POST[$key]);
		elseif($type == 'tel')
			$data = trim($_POST[$key]);
		else
			$data = $_POST[$key];
	
	$q = "UPDATE auditeurs SET ".$key." = '".addslashes(htmlentities($data))."' WHERE id = '".$_SESSION['user']['id']."' ";
	dbquery($q);	
	}
}

Header("Location: /espace_personnel/eleve/mon-dossier/index.php#2");
?>