For some reason the footer is displaying before the bale in my page, here is the code:
PHP Code:
<?php ################################### # File: listandconfirm.php # # Project: List Confirm System # # By: MeleFire # # Copyright 2007 # ################################### // Call Global Config File include("config.php"); //Call header file include 'header.php'; // Check for correct url if (isset($_GET['id'])) { $id=$_GET['id']; } elseif ( $_GET['id'] == "" ) { echo "No event was selected"; include 'footer.php'; exit; } else { echo "No event was selected"; include 'footer.php'; exit; } // Open DataBase Connection mysql_connect($dbloc,$dbuser,$dbpass); @mysql_select_db($dbname) or die( "Unable to select database"); // Set Querys $sql1 = "INSERT INTO `confirmed` (`Name`, `EventID`) VALUES ('$name', '$id');"; // Check for form submit if (isset($_POST['name'])) { $name=$_POST['name']; mysql_query($sql1); echo "<b><center>Added $name to event!</center></b>"; } // Load table of those already confirmed $table="confirmed"; // sending query $result = mysql_query("SELECT * FROM `$table` WHERE EventID='$id';"); if (!$result) { die("Query to show fields from table failed"); } $fields_num = mysql_num_fields($result); // Check if exists $sql2="SELECT * FROM `event` WHERE `ID` = '$id';"; $exist = mysql_query($sql2); $num=mysql_num_rows($exist); $q=0; if ($q == $num) { echo "<center><img src=images/ERROR.png><br />Event Does Not Exist!!<center>"; include 'footer.php'; exit; } // Print confirm form echo <<<END <center><h3>Sign up for this event</h3> <form action="listandconfirm.php?id=$id" method="post"> Name: <input type="text" name="name" /> <input type="submit" /> </form> END; // Check if user is first person $sql5="SELECT * FROM `confirmed` WHERE `EventID` = '$id';"; $first = mysql_query($sql5); $numcheck=mysql_num_rows($first); if ($q == $numcheck) { echo <<<END <table border="5"> <tr> <td><img src=images/first.gif></td> <td>If you register now you will be the first person to do so!</td> </tr> </table> END; include 'footer.php'; exit; } ################################## ## Print List #################### ################################## echo "<h1>List Of Campouts</h1>"; echo "<table border='3'><tr>"; // printing table headers for($i=0; $i<$fields_num; $i++) { $field = mysql_fetch_field($result); echo "<td><b>{$field->name}</b></td>"; } echo "</tr>\n"; // printing table rows while($row = mysql_fetch_row($result)) { echo "<tr>"; // $row is array... foreach( .. ) puts every element // of $row to $cell variable foreach($row as $cell) echo "<td>$cell</td>"; echo "</tr>\n</center>"; } mysql_free_result($result); // Display Footer echo <<<END </div> <div id="footer"> <p>www.troop439md.net</p> <h5>Event Registration System</h5> </div> </body> </html> END; ?>
|