There is a finished table that should be displayed by date, the same names remain in the "NAME" column, but subsequent columns should be filled in via a two-dimensional array by date. According to the principle, if I chose today's date, then I was given a column with names and (if this month has 30 days) for each column some kind of any figure for example, but if I choose a date with 28 days, then the same names are also filled already 28 columns are filled through a two-dimensional array.
DATE SELECTION
<input style=" width:200px; height:27px; position:absolute; left:50%;top:15%;z-index:2; margin-left:-130px; " id="monthToday" name="dateList" type="month"> <script> document.getElementById('monthToday').valueAsDate = new Date(); </script> <input style="margin:auto; width:40px; height:30px; position:absolute; left:50%;top:15%;z-index:2; margin-left:90px; " type="submit" value="ok"> FUNCTIONAL
<?php if(isset($_POST['dateList'])){ $inp_inf = $_POST['dateList']; }else{ $inp_inf = date('Ym-d'); } $date = new DateTime($inp_inf); $car_year = $date->format('Y') ; // 2018 $car_month = $date->format('m') ; // 1-12 текущий месяц $allcells = "<tr><td style='margin:auto;height:50px; font-weight:bold' colspan='32'align='center'>ДАТА ТАБЛИЦЫ $inp_inf </td></tr>"; $tablheader = "$allcells<tr><td style='width:200px;font-weight:bold; vertical-align: top'>Имя</td>"; // построение таблицы $i = 0; $w = "-" ; $day_w = 0 ; while($i++ < $date->format('t')) { $car_data = $car_year."-".$car_month."-".$i." 01:01:01" ; $tmp_data = strtotime($car_data); $day_w = date("N",$tmp_data); if($day_w==1) {$w = "Пн" ;} if($day_w==2) {$w = "Вт" ;} if($day_w==3) {$w = "Ср" ;} if($day_w==4) {$w = "Чт" ;} if($day_w==5) {$w = "Пт" ;} if($day_w==6) {$w = "Сб" ;} if($day_w==7) {$w = "Вс" ;} $tablheader = $tablheader."<td style='width:200px; vertical-align: top'>".$i." / ".$w."</td>" ; } // ЗАПИСЬ В ДВУХМЕРНОМ МАССИВЕ НАЧАЛО---------------------------------------------------------------------------------------------------------------------------- $row = 3;// количество строк $col = $i + 1;// кол. столбиков $n [0] = "Андрей"; $n [1] = "Олег"; $n [2] = "Володя"; $n [3] = "Дима"; $tablheader = $tablheader."</tr>"; echo $tablheader; ?>