Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/283.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PHP&;HTML创建表问题_Php_Html_Css - Fatal编程技术网

PHP&;HTML创建表问题

PHP&;HTML创建表问题,php,html,css,Php,Html,Css,我正在为明细表创建一个表,但无法正确设置其格式。下面是我的输出表的样子 Users| Action | Monday | Monday | Monday | Wednesday 09/23/13 09/23/13 09/23/13 09/25/13 11:00 AM 1:00 PM 2:00 PM 10:00 AM ----- -------- ----------

我正在为明细表创建一个表,但无法正确设置其格式。下面是我的输出表的样子

Users| Action |  Monday  |   Monday  |  Monday     | Wednesday
                09/23/13    09/23/13    09/23/13     09/25/13
                11:00 AM    1:00 PM     2:00 PM      10:00 AM
----- --------  ---------- ---------   -----------   -----------
Jack
John
Tim
我希望我的输出如下所示:

Users| Action |  Monday  |   Monday  |  Monday     | Wednesday
                09/23/13    09/23/13    09/23/13     09/25/13
                11:00 AM    1:00 PM     2:00 PM      10:00 AM
----- --------  ---------- ----------- ------------- ---------
Jack           
John              *          *                          *
Tim                                       *
       new
2013-09-23^11:00|13:00|14:00
这是从两个文本文件中读取数据,其中一个用于计划,如下所示:

Users| Action |  Monday  |   Monday  |  Monday     | Wednesday
                09/23/13    09/23/13    09/23/13     09/25/13
                11:00 AM    1:00 PM     2:00 PM      10:00 AM
----- --------  ---------- ----------- ------------- ---------
Jack           
John              *          *                          *
Tim                                       *
       new
2013-09-23^11:00|13:00|14:00
其中,用户文件的索引被可视化为如下所示

0                 1     2
2013-09-23^11:00|13:00|14:00
其中每个数字对应一个用户

eg用户文件

Jack
John^0|1|3
Tim^2
John的0映射到计划文件的第一个日期并将其标记

这是我的密码你知道怎么修吗?我需要首先根据计划文件读取的列,在每个用户中放入空行

<!DOCTYPE html>
<html>
 <head>
  <title>Scheduler</title>
 </head>
 <body>
<h2>
<form action = "update.php" method = "POST" >
<center>Select Your Meeting Times</center></h2>
<?php 
    echo "<table border= '1'
            cellpadding='10'>
            <tr>
            <th>User</th>
            <th>Action</th>";       

   date_default_timezone_set('America/New_York');
    //error_reporting(1);
    getTimes();
    displaySchedule(); 



    function displaySchedule()
    {

                // used for displaying schedule times 
                $text = "user.txt";     // open  up the user file. 
                $f  = fopen($text, "r+");



                if (file_exists("user.txt"))
                {

                    while($line = fgets($f,1000))
                    {
                    $name = getUsers($text, $line);
                    echo "<tr>" . "<td>" . $name . "</td>" . "</tr>\n";
                    }


                }else{
                    #create the file method. 
                }





        echo "<tr>" . "</tr>";  
    }




    #this method gets the users from the text file and diplays them. 
    function getUsers(&$text1, &$line)
    {
             list($name, $num) = explode('^', $line);
             $num1 = explode('|', $num); // num 1 now holds the number where the time entry mark goes   


            // setTimes($name, $num1) // sets the times for the user. 
             return $name;                  
    }                       

    #When the user is either new or active, set the times 
    function setTimes(&$name, &$num1)
    {



    }

     function getTimes()
    {


                $file = file("schedule.txt"); // open up the schedule file 


                                        // loop through the schedule file 
                    foreach($file as $s){                               
                        # s = string like '2013-04-11^12:00|4:00|14:00'
                        list($year, $rest) = explode("^", $s);
                        $rest_arr = explode("|", $rest); // time = 12:00 etc.. 
                        list($year, $month, $day) = explode('-', $year); // this cuts them down. 
                        $year= intval($year, 10);
                        $month= intval($month, 10);
                        $day= intval($day, 10);                         $h = mktime(0, 0, 0, $month, $day,$year);
                        $d = date("F dS, Y", $h); //used to get the day of the week 
                        $w= date("l", $h); // w now holds the day of the week.


                    // while through the schedule file, loop through each of times and displays them. 
                     foreach($rest_arr as $time){
                                //$convert = (string)$rest_arr;
                                //$convertedTime = date("g:ia", strtotime($convert));

                                echo "<th>" . $w . "<br>" . $month . "/" . $day . "/" . $year . "<br>" . $time . "</th>\n"; 

                                // sets the header

                    } // end this   

                } // end 1st foreach for file.
    }    



    function createFile()
    {

    }

    function drawTable()
    {

        $rows = 10; // define number of rows
        $cols = 4;// define number of columns

        echo "<table border='1'>"; 

        for($tr=1;$tr<=$rows;$tr++){ 

            echo "<tr>"; 
                for($td=1;$td<=$cols;$td++){ 
                       echo "<td>row: ".$tr." column: ".$td."</td>"; 
                } 
            echo "</tr>"; 
        } 

        echo "</table>"; 



    }


    echo "<th><br></th>
            <tr>
            <th>Total</th>
            </tr>
            </table>"; 

    ?>

 </body>
</html>

调度程序
选择您的会议时间

那么问题是如何在表格中添加星号?不,问题是如何根据用户文本文件填充空格和星号。。。我需要在用户旁边没有数字的每一行中有相同数量的空格,并且需要在有数字的位置放置一个标记。根据您是想要空白还是星号,我需要放置一个标记,并使用CSS将其居中。我已经尝试过,很明显,我知道如何使用它,其实没那么简单