Jump to content

how to show table information individually in php?


masnobi

Recommended Posts

Hi all, I am trying to show my table information individually, but I just cannot find the way of doing it. At the moment it looks like this- (pic1)

 

post-145918-0-06302200-1365343374_thumb.png

 

I want it to show like this - (pic2)

post-145918-0-30838400-1365344158_thumb.jpg

 

 

Here are my code

<?php       
 $depAirport=clean($_POST['depAirport']);
 $arrAirport=clean($_POST['arrAirport']);
 $dDate=clean($_POST['dDate']);
 $rDate=clean($_POST['rDate']);
 $adult=clean($_POST['adult']);
 $child=clean($_POST['child']);
 $infants=clean($_POST['infants']);
 $myList=clean($_POST['myList']);



  function clean($str) {
  $str = @trim($str);
        if(get_magic_quotes_gpc()) {
       $str = stripslashes($str);
     }
      return mysql_real_escape_string($str);
  }

                               
                $sql= "SELECT * from flight
WHERE
      departure_airport ='$depAirport' AND arrival_airport = '$arrAirport' AND departure_date ='$dDate'";
                  $result = mysql_query($sql);
    
               
                     
     echo "<table id='kool' border='1' cellpadding='2' summary='Table holds flight information'>
<tr>
    <th>Flight No</th>
    <th>Departure Airport</th>
    <th>Arrival Airport</th>
    <th>Departure Date</th>
    <th>Arrival Date</th>
    <th>Flight Price</th>
    <th>Flight Duration</th>
    <th>Airline</th>
</tr>";

while ($row = mysql_fetch_array($result)) {echo "<tr>";
echo "<td>" . $row['flight_no'] . "</td>";
echo "<td>" . $row['departure_airport'] . "</td>";
echo "<td>" . $row['arrival_airport'] . "</td>";
echo "<td>" . $row['departure_date'] . "</td>";
echo "<td>" . $row['arrival_date'] . "</td>";
echo "<td>" . '£' . $row['flight_price'] . "</td>";
echo "<td>" . $row['flight_duration'] . "</td>";
echo "<td>" . $row['flight_name'] . "</td>";
echo "</tr>"; }

?>
                <tr>
                <td colspan="18">Total fare per Adult is
                                                <?php echo '£' . 'flight_price';
            ?>
            <input type="submit" name="Select Flight" id="submit" style="float:right" />
            </td>
        </tr>
    </tfoot>
</table>

 

 

 

Please HELP

Edited by masnobi
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.