hey akaki, I'm no php master, but I see a few things wrong with your script, so maybe I'll be of some help.
1. you need to include '$month' in your function when you define the function and when you call the function as follows:
Function Definition:
function totalOrders($month)
Function Call:
<?php totalOrders($month);?>
also, as you can see from the "Function Call" example, you don't need to use the 'echo' command to print out the results of your function. You already told the function to 'echo $total'
in this line
$total = $total + count($data['Sl_No']);
you are looking for a table field called 'Sl_No' but no such field was selected as part of your initial query. Add that to the select fields as follows:
$q = "SELECT LabOrder_No, LogIn_Date, Sl_No FROM orders WHERE LogIn_Date = '$month'";
I don't think that covers all of the problems, but at least some of them. Without knowing the rest of your script, I'm gonna go out on a limb and suggest that you can't match the POST variable '$month' to your date field until you first strip out the year and day parts of that field. In other words, you need to make the yy-mm-dd date field stripped down to be just mm, so it will match your POST variable.
hope that helps a little,
-chris