Thank you
I have it working as a PHP layer from Mark's example - ie I can select $starttime from my DB and assign a time zone correctly based on this.
I am also trying to assign the time zone, on upload of a form.
My process file is doing this:
Code: Select all
<?php
include('../includes/dbconnect.php');
$error = false;
if (isset($_POST['addevent'])) {
$hostcompany = $_POST['hostcompany'];
$type = $_POST['type'];
$custom_event = $_POST['custom_event'];
$eventtitle = $_POST['eventtitle'];
$date = $_POST['date'];
$predate = $_POST['predate'];
$starttime = $_POST['starttime'];
$endtime = $_POST['endtime'];
$venue = $_POST['venue'];
$description = $_POST['description'];
$invite = $_POST['invite'];
$dateadded = $_POST['dateadded'];
$status = $_POST['status'];
$username = $_POST['username'];
$company = $_POST['company'];
$abc = strtotime($row['starttime']);
$hour = date("G:i",$abc);
$timezone = 0;
if (($hour >= 6) && ($hour < 12)) {
$timezone = 1;
} elseif (($hour >= 12) && ($hour < 17)) {
$timezone = 2;
} elseif ($hour >= 17) {
$timezone = 3;
}
$query = "INSERT INTO events (hostcompany,type,custom_event,eventtitle,date,predate,starttime,endtime,venue,description,invite,dateadded,status,username,company,timezone) VALUES ('".$hostcompany."','".$type."','".$custom_event."','".$eventtitle."','".$date."','".$predate."','".$starttime."','".$endtime."','".$venue."','".$description."','".$invite."','".$dateadded."','".$status."','".$username."','".$company."','".$timezone."')";
$result = mysql_query($query) or die(mysql_error().'<p>'.$query.'</p>');
Header("Location: /users/addevent.php?mesg=Event added sucessfully, thank you.");
exit;
}
else {
$error = true; // input validation failed
}
?>
However, when I try to assign the timezone in this way, I only get timezone of 3 input into my "timezone" field.
That's where I;m at - its working, but not on form upload to DB, so any pointers would be much appreciated.
Thanks a lot