<?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 ".$db_table." SET ".$key." = '".addslashes(htmlentities($data))."' WHERE ".$where." ";
	dbquery($q);	
	}
}

Header("Location: ".$_SERVER['HTTP_REFERER']);
?>