php - Display Array Value in Header (H1) Tag -


i use employee name in h1 tag. can please tell how this. see comment description further info.

<html> <head> <title>employee data</title> </head> <body> <h1>employee name _______ </h1> //i want display employee name here <?php error_reporting(0); include('config.php'); $qry = "select * emp_data ename='dinesh'"; $result = mysql_query($qry) or die (mysql_error()); echo '<table cellpadding="0" cellspacing="0" class="edb-table">';     while($row=mysql_fetch_array($result))      {         echo "<tr><td>name:</td><td><a href='emp_name.php?name=" . $row['emname'] . "'>".$row['emname'] . "</a></td></tr>";         echo "<tr><td>date of birth:</td><td>".$row['emdob'] . "</a></td></tr>";          echo "<tr><td>department:</td><td>".$row['emdepart'] . " </td></tr>";     }  echo "</table>"; mysql_close(); ?> </body> </html> 

so dagon suggested be:

<?php  error_reporting(0); include('config.php'); $table_content = ""; $employee_name = ""; $qry = "select * emp_data ename='dinesh'"; $result = mysql_query($qry) or die (mysql_error()); while($row=mysql_fetch_array($result))  {     $employee_name = $row['emname'];     $table_content .= "<tr><td>name:</td><td><a href='emp_name.php?name=" . $row['emname'] . "'>".$row['emname'] . "</a></td></tr>";     $table_content .= "<tr><td>date of birth:</td><td>".$row['emdob'] . "</a></td></tr>";      $table_content .= "<tr><td>department:</td><td>".$row['emdepart'] . " </td></tr>"; } mysql_close();  ?> <html>   <head>     <title>employee data</title>   </head>   <body>     <h1>employee name <?php echo $employee_name; ?></h1>     <table cellpadding="0" cellspacing="0" class="ddb-table">       <?php echo $table_content; ?>     </table>   </body> </html> 

Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -