Maybe I'm not understanding the complexity of this... but here is my stab. Select all items in orderdetails for that order_id, that are not shipped. if you have any results, you know that your order is not ready to be marked shipped
//this is of course written knowing nothing about the structure of your tables. and assuming you are using the most popular database (MySQL)
$sql = "
SELECT
order_id
FROM
order_details
WHERE
order_id = '$order_id'
AND
orderstatus != 'shipped'
";
$result = mysql_query($sql);
if(mysql_num_rows($result) > 0)
{
echo "Sorrybuddy the package is not ready to be marked shipped";
}
else
{
echo "YAY!!! we can mark the order shipped now!!!!";
}
edited because I forgot to close my PHP tag