tableにスケジュールを入れていく2

$timelist = array(540, 570, 600, 630, 660, 690, 780, 810, 840, 870, 900, 930, 960, 990, 1020);
$list = array("予約可","予約可","予約可","予約可","予約可","予約可","予約可","予約可","予約可","予約可","予約可","予約可","予約可","予約可","予約可");
$list1 = array("予約可","予約可","予約可","予約可","予約可","予約可","予約可","予約可","予約可","予約可","予約可","予約可","予約可","予約可","予約可");
$list2 = array("予約可","予約可","予約可","予約可","予約可","予約可","予約可","予約可","予約可","予約可","予約可","予約可","予約可","予約可","予約可");
$charge = array('松島','小野','草野');

foreach($result as $value){
	if($value['charge'] == $charge[0]){
		for($i=0; $i < count($timelist); $i++){
		if($timelist&#91;$i&#93; >= $value['time1'] and $timelist[$i] < $value&#91;'time2'&#93;){
			 $list&#91;$i&#93; = "×";
		}
	   }
	} elseif($value&#91;'charge'&#93; == $charge&#91;1&#93;){
		for($i=0; $i < count($timelist); $i++){
		if($timelist&#91;$i&#93; >= $value['time1'] and $timelist[$i] < $value&#91;'time2'&#93;){
			 $list1&#91;$i&#93; = "×";
		}
	   } 
	}elseif($value&#91;'charge'&#93; == $charge&#91;2&#93;){
		for($i=0; $i < count($timelist); $i++){
		if($timelist&#91;$i&#93; >= $value['time1'] and $timelist[$i] < $value&#91;'time2'&#93;){
			 $list2&#91;$i&#93; = "×";
		}
	  }
	 }
}

?>
<style>
#tbl-bdr table,#tbl-bdr td,#tbl-bdr th {
border-collapse: collapse;
border: 1px solid #000000;
}
table td{
	width:45px;
}
</style>

<br>
<div id="tbl-bdr">
<table>
<tr>
<td></td><td>9:00~</td><td>9:30~</td><td>10:00~</td><td>10:30~</td><td>11:00~</td><td>11:30~</td><td>13:00~</td><td>13:30~</td><td>14:00~</td><td>14:30~</td><td>15:00~</td><td>15:30~</td><td>16:00~</td><td>16:30~</td><td>17:00~</td>
</tr>
<tr>
<td><?php echo $charge&#91;0&#93;; ?></td>
<?php
	foreach($list as $value){
		echo "<td>". $value."</td>";
	}	
?>
</tr>
<tr>
<td><?php echo $charge&#91;1&#93;; ?></td>
<?php
	foreach($list1 as $value){
		echo "<td>". $value."</td>";
	}	
?>
</tr>
<tr>
<td><?php echo $charge&#91;2&#93;; ?></td>
<?php
	foreach($list2 as $value){
		echo "<td>". $value."</td>";
	}	
?>
</tr>
</table>

表示はこれでほぼOK(最終版は、現在時刻以降を表示したい)なんだが、これ、どうやって書くんだ??

あ、$listはfor文の中に書いて、かつ、tdもfor文で回すのか???

名前ごとにforeachを回す仕様に書き換えました。

<style>
#tbl-bdr table,#tbl-bdr td,#tbl-bdr th {
border-collapse: collapse;
border: 1px solid #000000;
}
table td{
	width:45px;
}
</style>

<br>
<div id="tbl-bdr">
<table>
<tr>
<td></td><td>9:00~</td><td>9:30~</td><td>10:00~</td><td>10:30~</td><td>11:00~</td><td>11:30~</td><td>13:00~</td><td>13:30~</td><td>14:00~</td><td>14:30~</td><td>15:00~</td><td>15:30~</td><td>16:00~</td><td>16:30~</td><td>17:00~</td>
</tr>
<?php 
$charge = array('松島','小野','草野');

foreach($charge as $value){
 echo "<tr><td>".$value. "</td>";

 $timelist = array(540, 570, 600, 630, 660, 690, 780, 810, 840, 870, 900, 930, 960, 990, 1020);
 $list = array("予約可","予約可","予約可","予約可","予約可","予約可","予約可","予約可","予約可","予約可","予約可","予約可","予約可","予約可","予約可");

	 foreach($result as $result1){
		if($result1['charge'] == $value){
			for($i=0; $i < count($timelist); $i++){
			if($timelist&#91;$i&#93; >= $result1['time1'] and $timelist[$i] < $result1&#91;'time2'&#93;){
				 $list&#91;$i&#93; = "×";
			} 
		  }
		}
	 }

	 foreach($list as $value){
	 	echo "<td>".$value."</td>";
	 }
 echo "</tr>";
}
?>
</table>

お!

formから草野さんに予約を入れます。

WoW!
次は、本日出勤の担当者のみ表示できるようにしたいですね。
mysql側で欠勤スケジュールのテーブルおよびdatepickerのformをつくります。