Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <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">
- <?php
- if(isset($_POST['dateList'])){
- $inp_inf = $_POST['dateList'];
- }else{
- $inp_inf = date('Y-m-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;
- ?>
Add Comment
Please, Sign In to add comment