2017-08-17 28 views
0

HTMLコンテンツは別々のファイルにあります。それらのファイルをphpファイルに含めました。ここでデータは表形式で表示されますが、体系的には表示されませんか?

問題は、データがそれぞれの見出しの下に来ていない、すなわち、 社員、EmployeeName、MOBILENUMBERは見出し「MOBILENUMBER」の下に来ているということです。

ヘッダーファイル:

<div class="row" style="height:370px; width:850px; overflow:scroll;"> 
<table border ='1' align = "center" id="FormTable" class="table" > 
    <tr> 
     <th> Employee Code 
     <th> Employee Name 
     <th> Mobile Number 
    <tr> 
     <td> 
     <td> 
     <td> 

フッターファイル:

</th> 
</th> 
</th> 
</tr> 
</td> 
</td> 
</td> 
</tr> 
</table> 
</div> 

メインファイル:

public function showEmployeeProfile() { 
     if (!isset($_SESSION["email"]) || !isset($_SESSION["passwrd"])) { 
      header("Location:index.php"); 
      // Cannot Access this page without Login. 
     } 
     if (empty($_POST)) { 
      if (isset($_SESSION['email'])) { 
       echo '<h3>' . "Welcome &nbsp '{$_SESSION['email']}'" . '</h3>'; 
       // Prints Email ID of the HR Manager. 
      } 

     echo '<h4>'.'<center>'."Profile Info of the Employees".'</center>'.'</h4>'.'<br/>'; 
     $read_sql = "select * from employeeprofile"; 
     $result_fetch = mysqli_query($this->connection, $read_sql); 
     include ("Header.php"); 
     while ($resultArr = $result_fetch->fetch_array()) { 
      echo $resultArr['EmployeeId'] . '<br/>'; 
      echo $resultArr['EmployeeName'] . '<br/>'; 
      echo $resultArr['MobileNumber'] . '<br/>' . '<hr/>'; 
     } 
     include ("Footer.php"); 
    } 
} 

私は変更がヘッダーとフッターファイルで行われる必要があると思う。

+0

あなたは​​要素でテーブルの行にデータをエコーされていません!だから、テーブルに正しく表示されません – RiggsFolly

答えて

2

3つのファイルすべてを修正する必要があります。あなたのヘッダーで

:あなたのフッターに

<tr> 
    <th>Employee Code</th> 
    <th>Employee Name</th> 
    <th>Mobile Number</th> 
</tr> 

</table>前にすべてのものを削除します。あなたのwhile()ループでは

echo '<tr>'; 
echo '<td>' . $resultArr['EmployeeId'] . '</td>'; 
echo '<td>' . $resultArr['EmployeeName'] . '</td>'; 
echo '<td>' . $resultArr['MobileNumber'] . '</td>'; 
echo '</tr>'; 
関連する問題