Page 1 of 1

Page redirect not working with some graphics

Posted: Tue Jan 24, 2006 5:20 pm
by ChocolateLover
Jcart | Please use

Code: Select all

and

Code: Select all

tags where appropriate when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]


Hi 
I have a file called availability

Code: Select all

<!-- Web Design -->
<?php 
require('includes/application_top.php');
?>
<html>
<head>
<title>The Mouse House - Luxury Villa Rental Florida - Prices and Availability</title>
<meta HTTP-EQUIV="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Keywords" content="">
<meta name="Description" content="">
<meta name="author" content="ic360 Limited Swindon, Wiltshire, UK">
<meta name="copyright" content="ic360 Limited Swindon, Wiltshire, UK">
<link rel="stylesheet" href="style.css">
<script src="includes/javascript.js" type="text/javascript" language="JavaScript"></script>
<script src="includes/writeFlash.js" type="text/javascript" language="JavaScript"></script>
<script src="includes/calendar.js" type="text/javascript" language="JavaScript"></script>
</head>

<body style="background-image:url(graphics/bg_page_mickey.gif);background-position:0 170;background-repeat:no-repeat" OnLoad="MM_preloadImages('graphics/buttons/prevmonth_over.gif','graphics/buttons/nextmonth_over.gif','graphics/buttons/wholeyear_over.gif','graphics/buttons/twomonth_over.gif','graphics/buttons/book_over.gif')">

<?php
	$currentpage = 'availability';
	include('includes/header.inc');
?>


<div id="contentlayout">
	<div id="contentleft" style="padding-left:20px">
		<span class="title">Villa Availability</span>
		<hr>
		<p>Please check availability of The Mouse House using the calendar.</p>
		<p>If the dates you want are available (<img src="graphics/colours/green.gif" width="31" height="24" hspace="3" alt="Available graphic" align="absmiddle">),<br>
		simply tick (<img src="graphics/checkbox_on.gif" width="12" height="12" hspace="3" alt="Checkbox graphic" align="absmiddle">) the days you require then click the <strong>Book Now</strong> button and complete our booking form. We shall respond as soon as possible to confirm your booking.</p>
		<div style="float:left;width:45%">
			<span class="subtitle">Pricing</span>
			<hr>
<?php
	$sql_seasons='select season_name, season_price, season_graphic from seasons order by season_price';
	$rs_seasons=(tep_db_query($sql_seasons));
	
?>			
			<table width="100%" cellspacing="3" cellpadding="5" border="0">
<?php
	while($row_seasons=tep_db_fetch_array($rs_seasons)) {;
?>
				<tr>
					<td><img src="<?php echo $row_seasons['season_graphic'];?>" width="31" height="11" alt="<?php echo $row_seasons['season_name'];?>"></td>
					<td><strong><?php echo $row_seasons['season_name'];?></strong><br>&pound;<?php echo $row_seasons['season_price'];?> / $<?php echo round(($row_seasons['season_price'] * USD)); ?> per week</td>
				</tr>
<?php
	}
?>
			</table>
				
		</div>
		<div style="float:right;width:45%">
			<span class="subtitle">Availability</span>
			<hr>

			<table width="100%" cellspacing="3" cellpadding="5" border="0">
				<tr>
					<td><img src="graphics/colours/green.gif" width="31" height="24" alt="Available"></td>
					<td><strong>Available</strong></td>
				</tr>
				<tr>
					<td><img src="graphics/colours/orange.gif" width="31" height="24" alt="Pending"></td>
					<td><strong>Pending</strong></td>
				</tr>
				<tr>
					<td><img src="graphics/colours/red.gif" width="31" height="24" alt="Booked"></td>
					<td><strong>Booked</strong></td>
				</tr>
			</table>

		</div>
		<br clear="all">
		<ul>
			<li>Pool heating (recommended October - April) £<?php echo POOL_HEATING_COST; ?>/ $<?php echo round(POOL_HEATING_COST * USD); ?> per week.</li>
			<li>Refundable Security Deposit £<?php echo SECURITY_DEPOSIT_COST; ?> / $<?php echo round(SECURITY_DEPOSIT_COST * USD); ?> per booking.</li>
			<li>Additional nights are charged pro rata.</li>
			<li>£<?php echo BOOKING_DEPOSIT_COST; ?> / $<?php echo round(BOOKING_DEPOSIT_COST * USD); ?> per week deposit to secure booking. Balance payable no later than 10 weeks prior to arrival.</li>
		</ul>
	</div>
<?php include('includes/calendar.php');?>
</div>
<?php include('includes/footer.inc'); ?>

<!-- Start of StatCounter Code -->
<script type="text/javascript" language="javascript">
var sc_project=1094167; 
var sc_invisible=1; 
var sc_partition=9; 
var sc_security="69c1ba13"; 
</script>

<script type="text/javascript" language="javascript" src="http://www.statcounter.com/counter/counter.js"></script><noscript><a href="http://www.statcounter.com/" target="_blank"><img  src="http://c10.statcounter.com/counter.php?sc_project=1094167&amp;java=0&amp;security=69c1ba13&amp;invisible=1" alt="free geoip" border="0"></a> </noscript>
<!-- End of StatCounter Code -->

</body>
</html>
which calls a file that generates a calendar

Code: Select all

<?php
	if ($_POST)	{
		if (isset($_POST['book_now_x'])) {
			$action = 'book';
		}
		if (isset($_POST['continue_x'])) {
			$action='continue';
		}	
		switch ($action) {
			case 'book':
				//check to make sure that some dates have been selected
				if (isset($_POST['book'])) {
					$_SESSION['book']=$_POST['book'];
					$URL='booking.php';
					header ("Location: $URL"); 
				} else {
				//no dates seected.  tell the user and then return to the calendar
?>
<div id="contentright" style="text-align:right">
<form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post" name="continue">
<table width="100%"  border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><p>You have not selected any dates!  Please press continue to return to the calendar.</p></td>
  </tr>
</table>
<br clear="all"><br>
<br clear="all"><br>
<input type="image" src="graphics/buttons/continue.gif" value="submit" alt="Book online now" title="Book online now" id="booknow" name="continue" onMouseOver="MM_swapImage('booknow','','graphics/buttons/continue_over.gif',1)" onMouseOut="MM_swapImgRestore()">
</form>
</div>
<?php
				}
				break;			
			case 'continue':
				//create the calendar
				echo tep_create_calendar();
				break;			
		}

	} else {
	//create the calendar, no POSTs set
		echo tep_create_calendar();
	}

?>
This works. The include checks to see whether any dates have been selected, and if they have it redirects to a booking form which gives the error:
Warning: Cannot modify header information - headers already sent by (output started at C:\Program Files\Apache Group\Apache2\htdocs\The Mouse House\test.php:80) in C:\Program Files\Apache Group\Apache2\htdocs\The Mouse House\includes\calendar.php on line 15

I've checked for white space etc.

I've narrowed it down to if I delete this bit of HTML it works.

Code: Select all

<table width="100%" cellspacing="3" cellpadding="5" border="0">
				<tr>
					<td><img src="graphics/colours/green.gif" width="31" height="24" alt="Available"></td>
					<td><strong>Available</strong></td>
				</tr>
				<tr>
					<td><img src="graphics/colours/orange.gif" width="31" height="24" alt="Pending"></td>
					<td><strong>Pending</strong></td>
				</tr>
				<tr>
					<td><img src="graphics/colours/red.gif" width="31" height="24" alt="Booked"></td>
					<td><strong>Booked</strong></td>
				</tr>
			</table>
More specifically, if I delete two of the rows, it works.

I can have 3 rows as long as only one has a graphic.

I didn't design the site, I'm just doing the PHP.

Can anyone suggest a workaround?

Any help would be appreciated.

Thanks.


Jcart | Please use

Code: Select all

and

Code: Select all

tags where appropriate when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]

Posted: Tue Jan 24, 2006 5:27 pm
by raghavan20
Search for the posts with keywords ' headers already sent '