<?php
session_start();
ob_start();
echo "Login is ". $_SESSION['login'];
echo "&nbsp;<a href=login.php?logout=1>Logout</a><br/><br/>";

require_once("../db.inc.php");

// Gestion des modifications
if (isset($_POST['name'])) {  // Modification d'un client existant
	$name=$_POST['name'];
	$email=$_POST['email'];
	$comment=$_POST['comment'];
	$id=$_POST['id'];
	$message=$_POST['message'];
	$query = "UPDATE clients SET name='$name',email='$email',comment='$comment',message='$message' WHERE id='$id'";
	pg_query($dbconn, $query) or die('Échec de la requête : ' . pg_last_error());
}

// Ferme la connexion
pg_close($dbconn);

header('Location: print_clients.php');
?>