Jump to content

how to eliminate empty spaces


zed420

Recommended Posts

Hi All

I wonder if someone can help me, I have a form where a customer has an option to book 1 or 2 vehicles by dropdown box so I’m using show/hide div for this which is working fine inserting the data all ok but when it comes to echo data it isn’t a pretty picture specially when I’m showing for two vehicles.  The result is all fine its out putting all what he should do.

Because there are empty spaces in database the table is not lining up properly  . Is there any way I can get rid of these empty spaces when it comes to echo.

 

This is how I’m inserting the data;

 	  if ($_POST['noOfVehicle'] == "1" ) {		
$query = "INSERT INTO restHotel  VALUES
('$status',NULL,'$dateTime','$passType','$noOfVehicle','$custname1','$des1','$roomNo1','$tableNo1','$vehicleType1','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','')";
   		if (@mysql_query($query)) {
		echo '<p>Your vehicle request has been sent Successfully </p>';
		} else {
		echo '<p>Error adding submitted Information: ' .
		mysql_error() . '</p>';
	}   
}
/************************************** Vehicle 2 ************************************/
  if ($_POST['noOfVehicle'] == "2" ) {		
$query = "INSERT INTO restHotel  VALUES
('$status',NULL,'$dateTime','$passType','$noOfVehicle','','','','','','$custname2','$des2','$roomNo2','$tableNo2','$vehicleType2','$custname3','$des3','$roomNo3','$tableNo3','$vehicleType3','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','')";
   		if (@mysql_query($query)) {
		echo '<p>Your vehicle request has been sent Successfully </p>';
		} else {
		echo '<p>Error adding submitted Information: ' .
		mysql_error() . '</p>';
	}   
} 

$query = "SELECT * FROM restHotel ORDER BY id DESC LIMIT 50";
   $result = mysql_query($query)or die(mysql_error());

	while ($row = mysql_fetch_array($result))  {
    extract($row);
	echo  "<tr >
	<td align=center>" . $row['id'] . "</td>
	<td align=center>" . $row['dateTime'] . "</td>
	<td align=center>" . $row['passType'] . "</td>
	<td align=center>" . $row['noOfVehicle'] . "</td>
                         <td align=center>" . $row['custname1'] . "</td>
	<td align=center>" . $row['des1'] . "</td>
	<td align=center>" . $row['roomNo1'] . "</td>
	<td align=center>" . $row['tableNo1'] . "</td>
	<td align=center>" . $row['vehicleType1'] . "</td></tr>";
echo "<tr><td></td><td></td><td></td><td></td>	
	<td align=center>" . $row['custname2'] . "</td>
	<td align=center>" . $row['des2'] . "</td>
	<td align=center>" . $row['roomNo2'] . "</td>
	<td align=center>" . $row['tableNo2'] . "</td>
	<td align=center>" . $row['vehicleType2'] . "</td></tr>";
echo "<tr>	<td></td><td></td><td></td><td></td>	
	<td align=center>" . $row['custname3'] . "</td>
	<td align=center>" . $row['des3'] . "</td>
	<td align=center>" . $row['roomNo3'] . "</td>
	<td align=center>" . $row['tableNo3'] . "</td>
	<td align=center>" . $row['vehicleType3'] . "</td></tr>";		
}
?></table></div>

Thanks

Zed

 

Link to comment
https://forums.phpfreaks.com/topic/138503-how-to-eliminate-empty-spaces/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.