Hi all,

In this program I want to display row one by one in table format. Please help me

Regards,

chelladurai P.C.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Revaluation : Sona College of Technology</title>
<link rel="stylesheet" type="text/css" href="stylesheet.css" />
<link rel="stylesheet" href="print.css" type="text/css" media="print" /> 
<script language="javascript">

function noBack()
{
window.history.forward(1);
}
</script>
</head>
<body onload="noBack();">

<div id="container">
<table border="0" align="center" cellpadding="0" cellspacing="0" id="Table_01">
<tr>
		<td class="top"><img src="../images/sona-college-logo.jpg" alt="logo" width="80" height="82" /></td>
	<td class="top"><div id="soit">SONA COLLEGE OF TECHNOLOGY</div>
	   <span id="emb">An Endearing Shrine for Excellence in Education</span> <br />
      <span class="nb1">Autonomous   Institution</span>  </td>
		<td class="top"><img src="../images/bvqi.jpg" alt="approved by aicte" width="111" height="51" /></td>
    </tr></table>
  <?php

$yes="500";
$department = $_POST['dept'];
$student = $_POST['name'];
$rege = $_POST['reg'];

$username="root";
$password="krish";
$database="test";


mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");



$cou = count($_POST['reva']);

?>
  <table align="center" class="c12">
    <tr>
      <td colspan="3"><h1>Revaluation Cum Photocopy for Dec '10 / Jan ' 11 Examinations</h1></td>
    </tr>
    <tr>
      <td colspan="3" align="center"><strong>INSTRUCTION TO THE CANDIDATES</strong></td>
    </tr>
    <tr>
      <td colspan="3"><p>1. Application for Revaluation cum photocopy must be submitted to the Principal on or before <strong>21.01.2011</strong> 5.00	PM.</p>
          <p>2. The candidate is advised to register for the course in which Revaluation cum photocopy is sought for within the stipulated 
            time for the next examination without waiting for the result of Revaluation.</p>
        <p>3. There is no provision for Revaluation cum photocopy of Practical &amp; Project examination papers.</p>
        <p>4. Incomplete / defective application will be rejected and the Revaluation fee will neither be refunded nor adjusted towards
          any fee due to the College.</p>
        <p>5. The head of the Department should ensure while recommending the application that the courseid and the course name filled in the respective columns by the candidate are verified and found to be correct.</p></td>
    </tr>
    <tr>
      <td colspan="3"><table class="che">
          <tr>
            <td width="489"><strong>1. Name:</strong></td>
            <td><strong>:</strong></td>
            <td width="467"><?php echo $student; ?></td>
          </tr>
        <tr>
          <td><strong>2. Register Number</strong></td>
          <td><strong>:</strong></td>
          <td><?php echo $rege; ?></td>
        </tr>
        <tr>
            <td><strong>3. Degree &amp; Branch Name </strong></td>
          <td><strong>:</strong></td>
          <td><?php echo $department; ?></td>
        </tr>
        <tr>
            <td><strong>4. Month &amp; Year of Examination </strong></td>
          <td><strong>:</strong></td>
          <td>December 2010 / January 2011</td>
        </tr>
        <tr>
            <td><strong>5. Number of the papers applied for Revaluation Cum Photocopy </strong></td>
          <td><strong>:</strong></td>
          <td><?php echo $cou; ?></td>
        </tr>
        <tr>
          <td><strong>6. Amount of fee paid to College </strong></td>
          <td><strong>:</strong></td>
          <td><?php echo "Rs." .intval($cou)*500; ?></td>
        </tr>
      </table></td>
    </tr>
    <tr>
      <td colspan="3"><strong>7. Courses for which Revaluation / Revaluation cum photocopy is required</strong></td>
    </tr>
    <?php

foreach ( $_POST['reva'] as $revunspl )
{
//list($rege,$title)=split(":",$revunspl);
list($courseid)= explode (":", $revunspl);

$res = "UPDATE name SET revaluation=$yes WHERE id = $rege AND courseid = '$courseid'" ;
mysql_query($res);
$query="SELECT * FROM name where id=$rege AND revaluation=$yes AND courseid='$courseid' order by courseid";
//echo $query;
$result=mysql_query($query);
$num=mysql_num_rows($result);
if ($num > 0) {

?>
    <tr>
      <td colspan="3"><table width="670">
          <tr>
            <td width="97"><strong>Semester</strong></td>
            <td width="121"><strong>Subject Code</strong></td>
            <td width="461"><strong>Subject Name</strong></td>
          </tr>
          <?php
$i=0;
while ($i < $num) {

$f10=mysql_result($result,$i,"sem");
$f9=mysql_result($result,$i,"courseid");
$f3=mysql_result($result,$i,"title");

?>
          <tr>
            <td><?php echo $f10; ?></td>
            <td><?php echo $f9; ?></td>
            <td><?php echo $f3;?></td>
          </tr>
          <?php

$i++;
 
	}
      
		 ?>
      </table></td>
    </tr>
    <?php
}
}
?>
    <tr>
      <td colspan="3"><p><strong>8. Recommendation of the HOD :</strong></p>
          <p>&nbsp;</p>
        <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<strong>Signature of the HOD</strong></p></td>
    </tr>
    <tr>
      <td colspan="2"><p><strong>Station :</strong><br />
        </p>
          <p><strong>Date :</strong></p></td>
      <td align="right"><strong>Signature of the Candidate<br />
            <br />
            <br />
            <br />
        Signature of the Principal</strong></td>
    </tr>
  </table>
  <?php

if($nam != $f1) {
echo "<div class='err'>Invalid Register Number. You are not eligible for Revaluation.</div>";
}

?>
  <a href="JavaScript:window.print();">Print this page</a> 
<div class="bottom">&copy; 2011 Sona College of Technology. All Rights Reserved.</div>
</div>

</body>
</html>

Specifically what part of this are you having trouble with?

Just from skimming your code, things look a bit unorganized. If you're just populating a form with data, it's probably best to gather your data in PHP at the top and then use print() for your HTML with PHP variables included.

-Ty

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.