I'm very new to PHP and have been using tutorials and help from across the net to create my site. But I can't find a working code to do what I need.
I have a table with a start date and end date and I want to calculate the duration between those dates in WORKING days (and exclude public holidays, if possible). I have an HTML form where the user inputs the start date and end date, then I want the php file handling the update to parse the duration field automatically.
Here's what I have, which is of course wrong, but maybe it will help explain what I'm trying to do:
//$_GET['all the variables from the HTML form'];
$id = $_POST['id'];
$bus_name = $_POST['bus_name'];
$web_url = $_POST['web_url'];
$image_name = $_POST['image_name'];
$start_date = $_POST['start_date'];
$end_date = $_POST['end_date'];
$duration = datediff($_POST['end_date'], $_POST['start_date']); //but this needs to only include weekdays (non-public holiday weekdays if possible)
// update data in mysql database
$sql="UPDATE table_name SET id='$id', bus_name='$bus_name', web_url='$web_url', image_name='$image_name', start_date='$start_date', end_date='$end_date', duration='$duration' WHERE id='$id'";
$result=mysql_query($sql);
I can't seem to find anything that works that takes data from a form and calculates it to write to the db.
Any help would be very much appreciated.