html - PHP keeps appearing at bottom of page -


i have written basic php page displays mysql table. table @ top of page, cannot seem working. go bottom.

below code, appreciated thankyou

<html> <body> <center> <h2>delete product details</h2> </center>  <?php include('db_conn.php'); //db connection include('session.php');  $query = "select * kit202_week5";  $result = $mysqli->query($query);  $fields_num = mysqli_num_fields($result);  echo "<table border='0'><tr>";  for($i=0; $i<$fields_num; $i++) {     $field = mysqli_fetch_field($result);     echo "<td>{$field->name}</td>"; } echo "</tr>\n";  while($row = mysqli_fetch_row($result)) {     echo "<tr>";      foreach($row $cell)         echo "<td>$cell</td>";      echo "</tr>\n"; }  mysqli_free_result($result);  if (isset($_post['delete'])) {     $id = mysqli_real_escape_string($mysqli, $_post['id']);      $deletequery = "delete kit202_week5 id='$_post[id]'";      if ($mysqli->query($deletequery) === true) {         echo "record deleted successfully";     } else {         echo "error deleting record: " . $mysqli->error;     }      header("location: tute6_delete.php"); }  $mysqli->close(); ?>  <h2>form</h2> <form method="post" action="tute6_delete.php"> id: <input type="text" name="id"></br><font color=red>*</font><p> <input type="submit" value="delete" name="delete"> <input type="reset" value="reset"><p> <input type="button" value="go main" onclick="window.location.href='signin_success.php'"> </form>  </body> </html> 

the table appearing @ bottom of page because have forgotten close table </table>.

the browser wants see table before works out how draw it. render other stuff comes across -- form etc. -- because that's there, still hoping </table> before putting table out. when reaches end of page, knows won't more table, draws has though incomplete.


Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

datatable - Matlab struct computations -