<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8"/>
		<title>Gestion des Points</title>
		<link rel="shortcut icon" type="image/x-icon" href="../mmd/favicon.ico"/>
		<link rel="stylesheet" href="../style.css">
		<link rel="stylesheet" href="style.css">
		<script type="text/javascript" src="jquery.js"></script>
	</head>

<?php

$data = $_POST;

$id = $_GET['id'];

?>
		<a href="<?php echo "afficheInfos.php?id=".$id ?>"><div class="back_arrow"></div></a>
		<style type="text/css">
		.back_arrow {
			background: url('../mmd/return.svg') no-repeat center;
			cursor: pointer;
			position: absolute;
			top: 50px;
			left: 50px;
			width: 50px;
			height: 50px;
			opacity: 1;
		}

		.back_arrow:hover {
			opacity: 0.5;
		}
		</style>
<?php

$db = mysql_connect('localhost', 'root', 'm148r43a9Y@%Z')  or die ('Erreur de connexion '.mysql_error());

mysql_select_db('smartpassTest2',$db) or die ('Erreur de selection '.mysql_error());

echo "<h1>Fin de la modification</h1>";
foreach ($data as $key => $value) {

	$strKey = strval($key);
	$strVal = addslashes(strval($value));

	$infosQu = explode("_", $strKey);

	$rq = "UPDATE {$infosQu[0]} SET {$infosQu[1]}='{$strVal}' WHERE id={$id}";
	mysql_query($rq) or die(mysql_error());;

	echo "<p  style='color:white;'>Les données de {$infosQu[1]} dans {$infosQu[0]} ont été modifiées pour le points d'ID {$id}</p>";
}
