<?php
	include('includes/config.php');
	
$id = $_POST['id'];
$activity = $_POST['activity'];
$date = $_POST['date'];
$time = $_POST['time'];
$street = $_POST['street'];
$city = $_POST['city'];
$clients = $_POST['clients'];
$persons = $_POST['persons'];
$province = $_POST['province'];
$pc_time = $_POST['pc_time'];
$pc_date = $_POST['pc_date'];
$pc_time = $_POST['pc_time'];
$pc_date = $_POST['pc_date'];
$user = $_POST['user'];


$out_client = array();
foreach ($clients as $value) {
    array_push($out_client, "$value");
}	
$out = array();
foreach ($persons as $val) {
    array_push($out, "$val"); 
}	
		$sched = $_POST['id'];
		
mysql_query("UPDATE schedules SET activity ='$activity', date ='$newDate', clients ='".implode('<br />', $out_client) ."', persons ='".implode('<br />', $out) ."', time ='$time', street='$street', city='$city', province='$province' WHERE sched_id ='$sched'") or die(mysql_error());  
		
echo "success";
mysql_query("INSERT INTO history (`data`,`actions`,`date`,`user`)VALUES('$id', 'updated sched', '$pc_date $pc_time', '$user')")or die(mysql_error());	
		
?>