<?php

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

$out = array();
foreach ($persons as $value) {
    array_push($out, "$value");
}	

$out_client = array();
foreach ($clients as $val) {
    array_push($out_client, "$val");
}
	
mysql_query("INSERT INTO schedules (`activity`, `date`, `time`, `persons`, `clients`, `street`, `city`, `province`) 
						VALUES('$activity', '$date', '$time', '".implode('<br />', $out) ."', '".implode('<br />', $out_client) ."', '$street', '$city', '$province')
			")
			or die(mysql_error());
echo "success";
mysql_query("INSERT INTO history (`data`,`actions`,`date`,`user`)VALUES('$activity', 'added sched', '$pc_date $pc_time', '$user')")or die(mysql_error());	

			?>
