session in right place?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
C_Calav
Forum Contributor
Posts: 395
Joined: Wed Jun 02, 2004 10:55 pm
Location: New Zealand

session in right place?

Post by C_Calav »

hi guys,

i get these errors on my show cart page:
Warning: Cannot modify header information - headers already sent by (output started at /var/users/modelair/modelaircraft.co.nz/htdocs/cart.php:10) in /var/users/modelair/modelaircraft.co.nz/htdocs/db.php on line 34

Warning: Cannot modify header information - headers already sent by (output started at /var/users/modelair/modelaircraft.co.nz/htdocs/cart.php:10) in /var/users/modelair/modelaircraft.co.nz/htdocs/db.php on line 34

Warning: Cannot modify header information - headers already sent by (output started at /var/users/modelair/modelaircraft.co.nz/htdocs/cart.php:10) in /var/users/modelair/modelaircraft.co.nz/htdocs/db.php on line 34
here is my db script, i have tried all sorts of arrangements with my session_starts but cant get working. i have got this working before but dont know what i did differently! can anyone see anything wrong?

thanx.

line 34 is: setcookie("cartId", session_id(), time() + ((3600 * 24) * 30));

Code: Select all

<?php
session_start(); 
// This page contains the connection routine for the 
// database as well as getting the ID of the cart, etc 
$dbServer = ""; 
$dbUser = ""; 
$dbPass = ""; 
$dbName = ""; 
function ConnectToDb($server, $user, $pass, $database) 
{ 
// Connect to the database and return 
// true/false depending on whether or 
// not a connection could be made. 
$s = @mysql_connect($server, $user, $pass); 
$d = @mysql_select_db($database, $s); 
if(!$s || !$d) 
return false; 
else 
return true; 
} 
function GetCartId() 
{ 
// This function will generate an encrypted string and 
// will set it as a cookie using set_cookie. This will 
// also be used as the cookieId field in the cart table 
if(isset($_COOKIE["cartId"])) 
{ 
return $_COOKIE["cartId"]; 
} 
else 
{ 
// There is no cookie set. We will set the cookie 
// and return the value of the users session ID 
setcookie("cartId", session_id(), time() + ((3600 * 24) * 30)); 
return session_id(); 
} 
} 
?>
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post by markl999 »

What on /var/users/modelair/modelaircraft.co.nz/htdocs/cart.php:10 ?
That's where output is being started.
User avatar
C_Calav
Forum Contributor
Posts: 395
Joined: Wed Jun 02, 2004 10:55 pm
Location: New Zealand

Post by C_Calav »

this is whats on line 10:

<script language="JavaScript" type="text/JavaScript">


what does this mean? do you need to look at any more code?
User avatar
MarK (CZ)
Forum Contributor
Posts: 239
Joined: Tue Apr 13, 2004 12:51 am
Location: Prague (CZ) / Vienna (A)
Contact:

Post by MarK (CZ) »

You just can't send any output (including white space and tags - such as <script>) before starting a session or setting a cookie...
User avatar
C_Calav
Forum Contributor
Posts: 395
Joined: Wed Jun 02, 2004 10:55 pm
Location: New Zealand

Post by C_Calav »

ive changed it to this

still get these errors:

Warning: Cannot modify header information - headers already sent by (output started at /var/users/modelair/modelaircraft.co.nz/htdocs/cart.php:9) in /var/users/modelair/modelaircraft.co.nz/htdocs/db.php on line 40

Warning: Cannot modify header information - headers already sent by (output started at /var/users/modelair/modelaircraft.co.nz/htdocs/cart.php:9) in /var/users/modelair/modelaircraft.co.nz/htdocs/db.php on line 40

line 9 is:<script language="JavaScript" type="text/JavaScript">

session start is at the top before anything is sent.. is this correct? obvisouly not if im getting errors.

Code: Select all

<?php
session_start()
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Links</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->



function UpdateQty(item) 
{ 
itemId = item.name; 
newQty = item.options[item.selectedIndex].text; 

document.location.href = 'cart.php?action=update_item&id='+itemId+'&qty='+newQty; 
} 



</script>
</head>

<body onLoad="MM_preloadImages('Website_Pics/Commercial%202.gif','Website_Pics/Famous_Air_Races.gif','Website_Pics/General_Aviation%202.gif','Website_Pics/USAF_Fighters.gif','Website_Pics/Banner_Menu/About%20Us%202.gif','Website_Pics/Banner_Menu/Contact%20Us%202.gif','Website_Pics/Banner_Menu/Custom%202.gif','Website_Pics/Banner_Menu/Order%202.gif','Website_Pics/Banner_Menu/Home%202.gif','Website_Pics/1st_Flight_2.gif','Website_Pics/Commercial_2.gif','Website_Pics/Famous_Air_Races_2.gif','Website_Pics/General_Aviation_2.gif','Website_Pics/Helicopters_2.gif','Website_Pics/NASA_2.gif','Website_Pics/Seaplanes_2.gif','Website_Pics/US_Army_2.gif','Website_Pics/US_Coastguard_2.gif','Website_Pics/US_Marine_Corps_2.gif','Website_Pics/US_Navy_2.gif','Website_Pics/USAF_Fighters_2.gif','Website_Pics/USAF_Jet_Transports_2.gif','Website_Pics/USAF_Piston_2.gif','Website_Pics/Vintage_Commercial_2.gif','Website_Pics/Vintage_Transports_2.gif','Website_Pics/WW_I_2.gif','Website_Pics/WWII_Bombers_2.gif','Website_Pics/WWII_Fighters_2.gif')">
<img src="spacer.gif" width="1" height="1"> 
<table width="701" align="center" cellpadding="0" cellspacing="0" background="Website_Pics/Background.jpg">
  <!--DWLayoutTable-->
  <tr> 
    <td height="1" colspan="3" valign="top" bgcolor="#666666"><img src="spacer.gif" width="1" height="1"></td>
    <td width="1"></td>
  </tr>
  <tr> 
    <td width="1" rowspan="9" valign="top" bgcolor="#666666"><img src="spacer.gif" width="1" height="1"></td>
    <td height="134" colspan="2" align="left" valign="middle"><img src="Website_Pics/Banner.jpg" width="699" height="134"></td>
    <td rowspan="9" valign="top" bgcolor="#666666"><img src="spacer.gif" width="1" height="1"></td>
  </tr>
  <tr> 
    <td height="1" colspan="2" valign="top" bgcolor="#000000"><img src="spacer.gif" width="1" height="1"></td>
  </tr>
  <tr> 
    <td height="19" colspan="2" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
        <!--DWLayoutTable-->
           <tr> 
            <td width="234" height="19" valign="top"><!--DWLayoutEmptyCell-->&nbsp;</td>
            <td width="45" valign="top"><a href="index.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Home','','Website_Pics/Banner_Menu/Home%202.gif',1)"><img src="Website_Pics/Banner_Menu/Home.gif" name="Home" width="45" height="19" border="0"></a></td>
            <td width="3" valign="top"><img src="Website_Pics/Banner_Menu/Space.gif" width="3" height="19"></td>
            <td width="61" valign="top"><a href="about_us.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('About','','Website_Pics/Banner_Menu/About%202.gif',1)"><img src="Website_Pics/Banner_Menu/About.gif" name="About" width="61" height="19" border="0"></a></td>
            <td width="3" valign="top"><img src="Website_Pics/Banner_Menu/Space.gif" width="3" height="19"></td>
            <td width="78" valign="top"><a href="contact_us.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Contact','','Website_Pics/Banner_Menu/Contact%202.gif',1)"><img src="Website_Pics/Banner_Menu/Contact.gif" name="Contact" width="78" height="19" border="0"></a></td>
            <td width="3" valign="top"><img src="Website_Pics/Banner_Menu/Space.gif" width="3" height="19"></td>
            <td width="124" valign="top"><a href="links.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Links','','Website_Pics/Banner_Menu/Aviation%202.gif',1)"><img src="Website_Pics/Banner_Menu/Aviation.gif" name="Links" width="124" height="19" border="0"></a></td>
            <td width="3" valign="top"><img src="Website_Pics/Banner_Menu/Space.gif" width="3" height="19"></td>
            <td width="145" valign="top"><a href="cart.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Cart','','Website_Pics/Banner_Menu/Cart%202.gif',1)"><img src="Website_Pics/Banner_Menu/Cart%202.gif" name="Cart" width="180" height="19" border="0"></a></td>
          </tr>
      </table></td>
  </tr>
  <tr> 
    <td height="1" colspan="2" valign="top" bgcolor="#666666"><img src="spacer.gif" width="1" height="1"></td>
  </tr>
  <tr> 
    <td width="176" height="21"></td>
    <td width="519"></td>
  </tr>
  <tr> 
    <td height="519" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
        <!--DWLayoutTable-->
        <tr> 
          <td width="185" height="19" valign="top"><a href="1st_flight.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Menu_1','','Website_Pics/1st_Flight_2.gif',1)"><img src="Website_Pics/1st_Flight.gif" name="Menu_1" width="177" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td height="19" valign="top"><a href="commercial.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Menu_2','','Website_Pics/Commercial_2.gif',1)"><img src="Website_Pics/Commercial.gif" name="Menu_2" width="177" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td height="19" valign="top"><a href="famous_air_races.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Menu_3','','Website_Pics/Famous_Air_Races_2.gif',1)"><img src="Website_Pics/Famous_Air_Races.gif" name="Menu_3" width="177" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td height="19" valign="top"><a href="general_aviation.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Menu_4','','Website_Pics/General_Aviation_2.gif',1)"><img src="Website_Pics/General_Aviation.gif" name="Menu_4" width="177" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td height="19" valign="top"><a href="helicopters.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Menu_5','','Website_Pics/Helicopters_2.gif',1)"><img src="Website_Pics/Helicopters.gif" name="Menu_5" width="177" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td height="19" valign="top"><a href="intl_military.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Menu_6','','Website_Pics/Intl_Military_2.gif',1)"><img src="Website_Pics/Intl_Military.gif" name="Menu_6" width="177" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td height="19" valign="top"><a href="nasa.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Menu_7','','Website_Pics/NASA_2.gif',1)"><img src="Website_Pics/NASA.gif" name="Menu_7" width="177" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td height="19" valign="top"><a href="seaplanes.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Menu_8','','Website_Pics/Seaplanes_2.gif',1)"><img src="Website_Pics/Seaplanes.gif" name="Menu_8" width="177" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td height="19" valign="top"><a href="us_army.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Menu_9','','Website_Pics/US_Army_2.gif',1)"><img src="Website_Pics/US_Army.gif" name="Menu_9" width="177" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td height="19" valign="top"><a href="us_coastguard.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Menu_10','','Website_Pics/US_Coastguard_2.gif',1)"><img src="Website_Pics/US_Coastguard.gif" name="Menu_10" width="177" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td height="19" valign="top"><a href="us_marine_corps.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Menu_11','','Website_Pics/US_Marine_Corps_2.gif',1)"><img src="Website_Pics/US_Marine_Corps.gif" name="Menu_11" width="177" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td height="19" valign="top"><a href="us_navy.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Menu_12','','Website_Pics/US_Navy_2.gif',1)"><img src="Website_Pics/US_Navy.gif" name="Menu_12" width="177" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td height="19" valign="top"><a href="usaf_fighters.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Menu_13','','Website_Pics/USAF_Fighters_2.gif',1)"><img src="Website_Pics/USAF_Fighters.gif" name="Menu_13" width="177" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td height="19" valign="top"><a href="usaf_jet_transports.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Menu_14','','Website_Pics/USAF_Jet_Transports_2.gif',1)"><img src="Website_Pics/USAF_Jet_Transports.gif" name="Menu_14" width="177" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td height="19" valign="top"><a href="usaf_piston.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Menu_15','','Website_Pics/USAF_Piston_2.gif',1)"><img src="Website_Pics/USAF_Piston.gif" name="Menu_15" width="177" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td height="19" valign="top"><a href="vintage_commercial.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Menu_16','','Website_Pics/Vintage_Commercial_2.gif',1)"><img src="Website_Pics/Vintage_Commercial.gif" name="Menu_16" width="177" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td height="19" valign="top"><a href="vintage_transports.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Menu_17','','Website_Pics/Vintage_Transports_2.gif',1)"><img src="Website_Pics/Vintage_Transports.gif" name="Menu_17" width="177" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td height="19" valign="top"><a href="ww_i.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Menu_18','','Website_Pics/WW_I_2.gif',1)"><img src="Website_Pics/WW_I.gif" name="Menu_18" width="177" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td height="19" valign="top"><a href="wwii_bombers.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Menu_19','','Website_Pics/WWII_Bombers_2.gif',1)"><img src="Website_Pics/WWII_Bombers.gif" name="Menu_19" width="177" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td height="19" valign="top"><a href="wwii_fighters.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Menu_20','','Website_Pics/WWII_Fighters_2.gif',1)"><img src="Website_Pics/WWII_Fighters.gif" name="Menu_20" width="177" height="19" border="0"></a></td>
        </tr>
      </table></td>
    <td valign="top"><table width="100%">
        <!--DWLayoutTable-->
        <tr> 
          <td height="42" colspan="2" valign="top"><!--DWLayoutEmptyCell-->&nbsp;</td>
        </tr>
        <tr> 
          <td width="487" rowspan="2" valign="top"><div align="justify"> 
              
	<?php 
    include("db.php"); 
        
   switch($_GET["action"]) 
   { 
      case "add_item": 
      { 
         AddItem($_GET["id"], $_GET["qty"]); 
         ShowCart($rs_cart); 
         break; 
      } 
      case "update_item": 
      { 
         UpdateItem($_GET["id"], $_GET["qty"]); 
         ShowCart($rs_cart); 
         break; 
      } 
      case "remove_item": 
      { 
         RemoveItem($_GET["id"]); 
         ShowCart($rs_cart); 
         break; 
      } 
      default: 
      { 
         ShowCart($rs_cart); 
      } 
   } 

   function AddItem($itemId, $qty) 
   { 
      // Will check whether or not this item 
      // already exists in the cart table. 
      // If it does, the UpdateItem function 
      // will be called instead 
        
      // Get a connection to the database 
        
      // Check if this item already exists in the users cart table 
      $result = mysql_query("SELECT count(*) FROM cart WHERE cookieId = '" . GetCartId() . "' AND itemId = $itemId"); 
      $row = mysql_fetch_row($result); 
      $numRows = $row[0]; 
        
      if($numRows == 0) 
      { 
         // This item doesn't exist in the users cart, 
         // we will add it with an insert query 

         @mysql_query("INSERT INTO cart(cookieId, itemId, qty) VALUES('" . GetCartId() . "', $itemId, $qty)"); 
      } 
      else 
      { 
         // This item already exists in the users cart, 
         // we will update it instead 
          
         UpdateItem($itemId, $qty); 
      } 
   } 
    
   function UpdateItem($itemId, $qty) 
   { 
      // Updates the quantity of an item in the users cart. 
      // If the qutnaity is zero, then RemoveItem will be 
      // called instead 


      if($qty == 0) 
      { 
         // Remove the item from the users cart 
         RemoveItem($itemId); 
      } 
      else 
      { 
         mysql_query("UPDATE cart SET qty =  $qty WHERE cookieId = '" . GetCartId() . "' AND itemId = $itemId"); 
      } 
   } 
    
   function RemoveItem($itemId) 
   { 
      // Uses an SQL delete statement to remove an item from 
      // the users cart 


      mysql_query("DELETE FROM cart WHERE cookieId = '" . GetCartId() . "' AND itemId = $itemId"); 
   } 
    
   function ShowCart() 
   { 
      // Gets each item from the cart table and display them in 
      // a tabulated format, as well as a final total for the cart 
        

      // Get a connection to the database 
        
      $totalCost = 0; 
      $result = mysql_query("select * from cart inner join planes on cart.itemId = planes.itemId where cart.cookieId = '" . GetCartId() . "' order by planes.P_Name asc");   
      ?> 
     
     <table> 
     <? 
     while($row = mysql_fetch_array($result))
      { 
      // Increment the total cost of all planes 
      $totalCost += ($row["qty"] * $row["P_Price"]); 
      ?> 
      
     <tr> 
      <td width="15%" height="25"> 
      <font face="verdana" size="1" color="black"> 
      <select name="<?php echo $row["itemId"]; ?>" onChange="UpdateQty(this)"> 
      
     <?php 
      for($i = 1; $i <= 20; $i++) 
      { 
      echo "<option "; 
      if($row["qty"] == $i) 
      { 
      echo " SELECTED "; 
      } 
      echo ">" . $i . "</option>"; 
      } 
      ?> 

      </select> 
      </font> 
      </td> 

      <td width="55%" height="25"> 
      <font face="verdana" size="1" color="black"> 
      <?php echo $row["P_Name"]; ?> 
      </font> 
      </td> 
      
     <td width="20%" height="25"> 
      <font face="verdana" size="1" color="black"> 
      $<?php echo number_format($row["P_Price"], 2, ".", ","); ?> 
      </font> 
      </td> 

      <td width="10%" height="25"> 
      <font face="verdana" size="1" color="black"> 
      <a href="cart.php?action=remove_item&id=<?php echo $row["itemId"]; ?>">Remove</a> 
      </font> 
      </td> 

      </tr> 
        
<? 
     } //You have to have this read as php 
?> 

<tr> 
<td width="100%" colspan="4"> 
<hr size="1" color="red" NOSHADE> 
</td> 
</tr> 
<tr> 
<td width="70%" colspan="2"> 
<font face="verdana" size="1" color="black"> 
<a href="index.php"><< Keep Shopping</a> 
</font> 
</td> 
<td width="30%" colspan="2"> 
<font face="verdana" size="2" color="black"> 
<b>Total: $<?php echo number_format($totalCost, 2, ".", ","); ?></b> 
</font> 
</td> 
</tr> 
</table> 

<? 
     } //You have to have this read as php 
?> 
			  
            </div></td>
          <td width="18" height="182" valign="top"><!--DWLayoutEmptyCell-->&nbsp;</td>
        </tr>
        <tr> 
          <td height="31">&nbsp;</td>
        </tr>
        <tr>
          <td height="252">&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
      </table></td>
  </tr>
  <tr> 
    <td height="17"></td>
    <td></td>
  </tr>
  <tr>
    <td height="20" colspan="2" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
        <!--DWLayoutTable-->
        <tr> 
          <td height="1" colspan="12" valign="top" bgcolor="#666666"><img src="spacer.gif" width="1" height="1"></td>
        </tr>
          <tr> 
            <td width="234" height="19" valign="top"><!--DWLayoutEmptyCell-->&nbsp;</td>
            <td width="45" valign="top"><a href="index.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Home','','Website_Pics/Banner_Menu/Home%202.gif',1)"><img src="Website_Pics/Banner_Menu/Home.gif" name="Home" width="45" height="19" border="0"></a></td>
            <td width="3" valign="top"><img src="Website_Pics/Banner_Menu/Space.gif" width="3" height="19"></td>
            <td width="61" valign="top"><a href="about_us.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('About','','Website_Pics/Banner_Menu/About%202.gif',1)"><img src="Website_Pics/Banner_Menu/About.gif" name="About" width="61" height="19" border="0"></a></td>
            <td width="3" valign="top"><img src="Website_Pics/Banner_Menu/Space.gif" width="3" height="19"></td>
            <td width="78" valign="top"><a href="contact_us.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Contact','','Website_Pics/Banner_Menu/Contact%202.gif',1)"><img src="Website_Pics/Banner_Menu/Contact.gif" name="Contact" width="78" height="19" border="0"></a></td>
            <td width="3" valign="top"><img src="Website_Pics/Banner_Menu/Space.gif" width="3" height="19"></td>
            <td width="124" valign="top"><a href="links.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Links','','Website_Pics/Banner_Menu/Aviation%202.gif',1)"><img src="Website_Pics/Banner_Menu/Aviation.gif" name="Links" width="124" height="19" border="0"></a></td>
            <td width="3" valign="top"><img src="Website_Pics/Banner_Menu/Space.gif" width="3" height="19"></td>
            <td width="145" valign="top"><a href="cart.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Cart','','Website_Pics/Banner_Menu/Cart%202.gif',1)"><img src="Website_Pics/Banner_Menu/Cart%202.gif" name="Cart" width="180" height="19" border="0"></a></td>
          </tr>
      </table></td>
    </tr>
  <tr> 
    <td height='1' colspan='2' valign='top' bgcolor='#666666'><img src='spacer.gif' width="1" height="1"></td>
  </tr>
</table>

</body>
</html>
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post by markl999 »

It's just saying that /var/users/modelair/modelaircraft.co.nz/htdocs/db.php on line 40 has sent a header after output has been sent.
So whatever line 40 is doing, it needs to do it before any output is sent, and the output being sent is started on line 9 of cart.php
User avatar
C_Calav
Forum Contributor
Posts: 395
Joined: Wed Jun 02, 2004 10:55 pm
Location: New Zealand

Post by C_Calav »

ok, i see, so how can i fix this error?

put all the php code before the html etc or is it more complicated than that?
kettle_drum
DevNet Resident
Posts: 1150
Joined: Sun Jul 20, 2003 9:25 pm
Location: West Yorkshire, England

Post by kettle_drum »

Its not about your session_start(), its about you sending a cookie or session after you have already posted data to the user. If you have to send data to the user before you set the cookie/session then use ob_start() and relevant functions to buffer the output.
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post by markl999 »

Well you can use output buffering which will allow you to output headers even after sending content but i've never liked that method.
You really just need to restructure your code so that you do all your setting of cookies etc before you start on the actual html output.
User avatar
C_Calav
Forum Contributor
Posts: 395
Joined: Wed Jun 02, 2004 10:55 pm
Location: New Zealand

Post by C_Calav »

thanx mark, thats what i 'thought'i was doing before. can you help me re structre my code? or give me some help as to what goes where please.

i did it once before and it worked but i forgot how i did it!
User avatar
C_Calav
Forum Contributor
Posts: 395
Joined: Wed Jun 02, 2004 10:55 pm
Location: New Zealand

Post by C_Calav »

maybe some one could show me like this how to re-arrange the code?

or does it more complicated than that.]


thanx guys

just example:

<?php session_start(); ?>

<html>
<script language="JavaScript"></script>

<php
include(db.php)

show cart etc
?>

</html>
User avatar
C_Calav
Forum Contributor
Posts: 395
Joined: Wed Jun 02, 2004 10:55 pm
Location: New Zealand

Post by C_Calav »

ps: mark

am i not setting my cookie etc in the db.php file there for setting it before i output any html?
User avatar
fresh
Forum Contributor
Posts: 259
Joined: Mon Jun 14, 2004 10:39 am
Location: Amerika

Post by fresh »

you can not call headers or set cookies after the header has already been sent, i.e, your html code..

put ALL your PHP besides your var calls on top of the page, BEFORE the HTML.. ;)

also, edit out sensitive info, before posting.. :)
User avatar
C_Calav
Forum Contributor
Posts: 395
Joined: Wed Jun 02, 2004 10:55 pm
Location: New Zealand

Post by C_Calav »

thanx fresh.. i did what you said. is this right?

i get these errors now with this code:

more re-aranging?

Warning: Cannot modify header information - headers already sent by (output started at /var/users/modelair/modelaircraft.co.nz/htdocs/db.php:45) in /var/users/modelair/modelaircraft.co.nz/htdocs/db.php on line 40

Warning: Cannot modify header information - headers already sent by (output started at /var/users/modelair/modelaircraft.co.nz/htdocs/db.php:45) in /var/users/modelair/modelaircraft.co.nz/htdocs/db.php on line 40

Code: Select all

<?php
session_start();
    include("db.php"); 
        
   switch($_GET["action"]) 
   { 
      case "add_item": 
      { 
         AddItem($_GET["id"], $_GET["qty"]); 
         ShowCart($rs_cart); 
         break; 
      } 
      case "update_item": 
      { 
         UpdateItem($_GET["id"], $_GET["qty"]); 
         ShowCart($rs_cart); 
         break; 
      } 
      case "remove_item": 
      { 
         RemoveItem($_GET["id"]); 
         ShowCart($rs_cart); 
         break; 
      } 
      default: 
      { 
         ShowCart($rs_cart); 
      } 
   } 

   function AddItem($itemId, $qty) 
   { 
      // Will check whether or not this item 
      // already exists in the cart table. 
      // If it does, the UpdateItem function 
      // will be called instead 
        
      // Get a connection to the database 
        
      // Check if this item already exists in the users cart table 
      $result = mysql_query("SELECT count(*) FROM cart WHERE cookieId = '" . GetCartId() . "' AND itemId = $itemId"); 
      $row = mysql_fetch_row($result); 
      $numRows = $row[0]; 
        
      if($numRows == 0) 
      { 
         // This item doesn't exist in the users cart, 
         // we will add it with an insert query 

         @mysql_query("INSERT INTO cart(cookieId, itemId, qty) VALUES('" . GetCartId() . "', $itemId, $qty)"); 
      } 
      else 
      { 
         // This item already exists in the users cart, 
         // we will update it instead 
          
         UpdateItem($itemId, $qty); 
      } 
   } 
    
   function UpdateItem($itemId, $qty) 
   { 
      // Updates the quantity of an item in the users cart. 
      // If the qutnaity is zero, then RemoveItem will be 
      // called instead 


      if($qty == 0) 
      { 
         // Remove the item from the users cart 
         RemoveItem($itemId); 
      } 
      else 
      { 
         mysql_query("UPDATE cart SET qty =  $qty WHERE cookieId = '" . GetCartId() . "' AND itemId = $itemId"); 
      } 
   } 
    
   function RemoveItem($itemId) 
   { 
      // Uses an SQL delete statement to remove an item from 
      // the users cart 


      mysql_query("DELETE FROM cart WHERE cookieId = '" . GetCartId() . "' AND itemId = $itemId"); 
   } 
    
   function ShowCart() 
   { 
      // Gets each item from the cart table and display them in 
      // a tabulated format, as well as a final total for the cart 
        

      // Get a connection to the database 
        
      $totalCost = 0; 
      $result = mysql_query("select * from cart inner join planes on cart.itemId = planes.itemId where cart.cookieId = '" . GetCartId() . "' order by planes.P_Name asc");   
      ?> 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Links</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->



function UpdateQty(item) 
{ 
itemId = item.name; 
newQty = item.options[item.selectedIndex].text; 

document.location.href = 'cart.php?action=update_item&id='+itemId+'&qty='+newQty; 
} 



</script>
</head>

<body onLoad="MM_preloadImages('Website_Pics/Commercial%202.gif','Website_Pics/Famous_Air_Races.gif','Website_Pics/General_Aviation%202.gif','Website_Pics/USAF_Fighters.gif','Website_Pics/Banner_Menu/About%20Us%202.gif','Website_Pics/Banner_Menu/Contact%20Us%202.gif','Website_Pics/Banner_Menu/Custom%202.gif','Website_Pics/Banner_Menu/Order%202.gif','Website_Pics/Banner_Menu/Home%202.gif','Website_Pics/1st_Flight_2.gif','Website_Pics/Commercial_2.gif','Website_Pics/Famous_Air_Races_2.gif','Website_Pics/General_Aviation_2.gif','Website_Pics/Helicopters_2.gif','Website_Pics/NASA_2.gif','Website_Pics/Seaplanes_2.gif','Website_Pics/US_Army_2.gif','Website_Pics/US_Coastguard_2.gif','Website_Pics/US_Marine_Corps_2.gif','Website_Pics/US_Navy_2.gif','Website_Pics/USAF_Fighters_2.gif','Website_Pics/USAF_Jet_Transports_2.gif','Website_Pics/USAF_Piston_2.gif','Website_Pics/Vintage_Commercial_2.gif','Website_Pics/Vintage_Transports_2.gif','Website_Pics/WW_I_2.gif','Website_Pics/WWII_Bombers_2.gif','Website_Pics/WWII_Fighters_2.gif')">
<img src="spacer.gif" width="1" height="1"> 
<table width="701" align="center" cellpadding="0" cellspacing="0" background="Website_Pics/Background.jpg">
  <!--DWLayoutTable-->
  <tr> 
    <td height="1" colspan="3" valign="top" bgcolor="#666666"><img src="spacer.gif" width="1" height="1"></td>
    <td width="1"></td>
  </tr>
  <tr> 
    <td width="1" rowspan="9" valign="top" bgcolor="#666666"><img src="spacer.gif" width="1" height="1"></td>
    <td height="134" colspan="2" align="left" valign="middle"><img src="Website_Pics/Banner.jpg" width="699" height="134"></td>
    <td rowspan="9" valign="top" bgcolor="#666666"><img src="spacer.gif" width="1" height="1"></td>
  </tr>
  <tr> 
    <td height="1" colspan="2" valign="top" bgcolor="#000000"><img src="spacer.gif" width="1" height="1"></td>
  </tr>
  <tr> 
    <td height="19" colspan="2" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
        <!--DWLayoutTable-->
           <tr> 
            <td width="234" height="19" valign="top"><!--DWLayoutEmptyCell-->&nbsp;</td>
            <td width="45" valign="top"><a href="index.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Home','','Website_Pics/Banner_Menu/Home%202.gif',1)"><img src="Website_Pics/Banner_Menu/Home.gif" name="Home" width="45" height="19" border="0"></a></td>
            <td width="3" valign="top"><img src="Website_Pics/Banner_Menu/Space.gif" width="3" height="19"></td>
            <td width="61" valign="top"><a href="about_us.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('About','','Website_Pics/Banner_Menu/About%202.gif',1)"><img src="Website_Pics/Banner_Menu/About.gif" name="About" width="61" height="19" border="0"></a></td>
            <td width="3" valign="top"><img src="Website_Pics/Banner_Menu/Space.gif" width="3" height="19"></td>
            <td width="78" valign="top"><a href="contact_us.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Contact','','Website_Pics/Banner_Menu/Contact%202.gif',1)"><img src="Website_Pics/Banner_Menu/Contact.gif" name="Contact" width="78" height="19" border="0"></a></td>
            <td width="3" valign="top"><img src="Website_Pics/Banner_Menu/Space.gif" width="3" height="19"></td>
            <td width="124" valign="top"><a href="links.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Links','','Website_Pics/Banner_Menu/Aviation%202.gif',1)"><img src="Website_Pics/Banner_Menu/Aviation.gif" name="Links" width="124" height="19" border="0"></a></td>
            <td width="3" valign="top"><img src="Website_Pics/Banner_Menu/Space.gif" width="3" height="19"></td>
            <td width="145" valign="top"><a href="cart.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Cart','','Website_Pics/Banner_Menu/Cart%202.gif',1)"><img src="Website_Pics/Banner_Menu/Cart%202.gif" name="Cart" width="180" height="19" border="0"></a></td>
          </tr>
      </table></td>
  </tr>
  <tr> 
    <td height="1" colspan="2" valign="top" bgcolor="#666666"><img src="spacer.gif" width="1" height="1"></td>
  </tr>
  <tr> 
    <td width="176" height="21"></td>
    <td width="519"></td>
  </tr>
  <tr> 
    <td height="519" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
        <!--DWLayoutTable-->
        <tr> 
          <td width="185" height="19" valign="top"><a href="1st_flight.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Menu_1','','Website_Pics/1st_Flight_2.gif',1)"><img src="Website_Pics/1st_Flight.gif" name="Menu_1" width="177" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td height="19" valign="top"><a href="commercial.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Menu_2','','Website_Pics/Commercial_2.gif',1)"><img src="Website_Pics/Commercial.gif" name="Menu_2" width="177" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td height="19" valign="top"><a href="famous_air_races.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Menu_3','','Website_Pics/Famous_Air_Races_2.gif',1)"><img src="Website_Pics/Famous_Air_Races.gif" name="Menu_3" width="177" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td height="19" valign="top"><a href="general_aviation.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Menu_4','','Website_Pics/General_Aviation_2.gif',1)"><img src="Website_Pics/General_Aviation.gif" name="Menu_4" width="177" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td height="19" valign="top"><a href="helicopters.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Menu_5','','Website_Pics/Helicopters_2.gif',1)"><img src="Website_Pics/Helicopters.gif" name="Menu_5" width="177" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td height="19" valign="top"><a href="intl_military.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Menu_6','','Website_Pics/Intl_Military_2.gif',1)"><img src="Website_Pics/Intl_Military.gif" name="Menu_6" width="177" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td height="19" valign="top"><a href="nasa.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Menu_7','','Website_Pics/NASA_2.gif',1)"><img src="Website_Pics/NASA.gif" name="Menu_7" width="177" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td height="19" valign="top"><a href="seaplanes.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Menu_8','','Website_Pics/Seaplanes_2.gif',1)"><img src="Website_Pics/Seaplanes.gif" name="Menu_8" width="177" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td height="19" valign="top"><a href="us_army.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Menu_9','','Website_Pics/US_Army_2.gif',1)"><img src="Website_Pics/US_Army.gif" name="Menu_9" width="177" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td height="19" valign="top"><a href="us_coastguard.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Menu_10','','Website_Pics/US_Coastguard_2.gif',1)"><img src="Website_Pics/US_Coastguard.gif" name="Menu_10" width="177" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td height="19" valign="top"><a href="us_marine_corps.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Menu_11','','Website_Pics/US_Marine_Corps_2.gif',1)"><img src="Website_Pics/US_Marine_Corps.gif" name="Menu_11" width="177" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td height="19" valign="top"><a href="us_navy.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Menu_12','','Website_Pics/US_Navy_2.gif',1)"><img src="Website_Pics/US_Navy.gif" name="Menu_12" width="177" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td height="19" valign="top"><a href="usaf_fighters.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Menu_13','','Website_Pics/USAF_Fighters_2.gif',1)"><img src="Website_Pics/USAF_Fighters.gif" name="Menu_13" width="177" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td height="19" valign="top"><a href="usaf_jet_transports.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Menu_14','','Website_Pics/USAF_Jet_Transports_2.gif',1)"><img src="Website_Pics/USAF_Jet_Transports.gif" name="Menu_14" width="177" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td height="19" valign="top"><a href="usaf_piston.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Menu_15','','Website_Pics/USAF_Piston_2.gif',1)"><img src="Website_Pics/USAF_Piston.gif" name="Menu_15" width="177" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td height="19" valign="top"><a href="vintage_commercial.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Menu_16','','Website_Pics/Vintage_Commercial_2.gif',1)"><img src="Website_Pics/Vintage_Commercial.gif" name="Menu_16" width="177" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td height="19" valign="top"><a href="vintage_transports.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Menu_17','','Website_Pics/Vintage_Transports_2.gif',1)"><img src="Website_Pics/Vintage_Transports.gif" name="Menu_17" width="177" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td height="19" valign="top"><a href="ww_i.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Menu_18','','Website_Pics/WW_I_2.gif',1)"><img src="Website_Pics/WW_I.gif" name="Menu_18" width="177" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td height="19" valign="top"><a href="wwii_bombers.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Menu_19','','Website_Pics/WWII_Bombers_2.gif',1)"><img src="Website_Pics/WWII_Bombers.gif" name="Menu_19" width="177" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td height="19" valign="top"><a href="wwii_fighters.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Menu_20','','Website_Pics/WWII_Fighters_2.gif',1)"><img src="Website_Pics/WWII_Fighters.gif" name="Menu_20" width="177" height="19" border="0"></a></td>
        </tr>
      </table></td>
    <td valign="top"><table width="100%">
        <!--DWLayoutTable-->
        <tr> 
          <td height="42" colspan="2" valign="top"><!--DWLayoutEmptyCell-->&nbsp;</td>
        </tr>
        <tr> 
          <td width="487" rowspan="2" valign="top"><div align="justify"> 
              
	
     
     <table> 
     <? 
     while($row = mysql_fetch_array($result))
      { 
      // Increment the total cost of all planes 
      $totalCost += ($row["qty"] * $row["P_Price"]); 
      ?> 
      
     <tr> 
      <td width="15%" height="25"> 
      <font face="verdana" size="1" color="black"> 
      <select name="<?php echo $row["itemId"]; ?>" onChange="UpdateQty(this)"> 
      
     <?php 
      for($i = 1; $i <= 20; $i++) 
      { 
      echo "<option "; 
      if($row["qty"] == $i) 
      { 
      echo " SELECTED "; 
      } 
      echo ">" . $i . "</option>"; 
      } 
      ?> 

      </select> 
      </font> 
      </td> 

      <td width="55%" height="25"> 
      <font face="verdana" size="1" color="black"> 
      <?php echo $row["P_Name"]; ?> 
      </font> 
      </td> 
      
     <td width="20%" height="25"> 
      <font face="verdana" size="1" color="black"> 
      $<?php echo number_format($row["P_Price"], 2, ".", ","); ?> 
      </font> 
      </td> 

      <td width="10%" height="25"> 
      <font face="verdana" size="1" color="black"> 
      <a href="cart.php?action=remove_item&id=<?php echo $row["itemId"]; ?>">Remove</a> 
      </font> 
      </td> 

      </tr> 
        
<? 
     } //You have to have this read as php 
?> 

<tr> 
<td width="100%" colspan="4"> 
<hr size="1" color="red" NOSHADE> 
</td> 
</tr> 
<tr> 
<td width="70%" colspan="2"> 
<font face="verdana" size="1" color="black"> 
<a href="index.php"><< Keep Shopping</a> 
</font> 
</td> 
<td width="30%" colspan="2"> 
<font face="verdana" size="2" color="black"> 
<b>Total: $<?php echo number_format($totalCost, 2, ".", ","); ?></b> 
</font> 
</td> 
</tr> 
</table> 

<? 
     } //You have to have this read as php 
?> 
			  
            </div></td>
          <td width="18" height="182" valign="top"><!--DWLayoutEmptyCell-->&nbsp;</td>
        </tr>
        <tr> 
          <td height="31">&nbsp;</td>
        </tr>
        <tr>
          <td height="252">&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
      </table></td>
  </tr>
  <tr> 
    <td height="17"></td>
    <td></td>
  </tr>
  <tr>
    <td height="20" colspan="2" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
        <!--DWLayoutTable-->
        <tr> 
          <td height="1" colspan="12" valign="top" bgcolor="#666666"><img src="spacer.gif" width="1" height="1"></td>
        </tr>
          <tr> 
            <td width="234" height="19" valign="top"><!--DWLayoutEmptyCell-->&nbsp;</td>
            <td width="45" valign="top"><a href="index.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Home','','Website_Pics/Banner_Menu/Home%202.gif',1)"><img src="Website_Pics/Banner_Menu/Home.gif" name="Home" width="45" height="19" border="0"></a></td>
            <td width="3" valign="top"><img src="Website_Pics/Banner_Menu/Space.gif" width="3" height="19"></td>
            <td width="61" valign="top"><a href="about_us.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('About','','Website_Pics/Banner_Menu/About%202.gif',1)"><img src="Website_Pics/Banner_Menu/About.gif" name="About" width="61" height="19" border="0"></a></td>
            <td width="3" valign="top"><img src="Website_Pics/Banner_Menu/Space.gif" width="3" height="19"></td>
            <td width="78" valign="top"><a href="contact_us.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Contact','','Website_Pics/Banner_Menu/Contact%202.gif',1)"><img src="Website_Pics/Banner_Menu/Contact.gif" name="Contact" width="78" height="19" border="0"></a></td>
            <td width="3" valign="top"><img src="Website_Pics/Banner_Menu/Space.gif" width="3" height="19"></td>
            <td width="124" valign="top"><a href="links.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Links','','Website_Pics/Banner_Menu/Aviation%202.gif',1)"><img src="Website_Pics/Banner_Menu/Aviation.gif" name="Links" width="124" height="19" border="0"></a></td>
            <td width="3" valign="top"><img src="Website_Pics/Banner_Menu/Space.gif" width="3" height="19"></td>
            <td width="145" valign="top"><a href="cart.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Cart','','Website_Pics/Banner_Menu/Cart%202.gif',1)"><img src="Website_Pics/Banner_Menu/Cart%202.gif" name="Cart" width="180" height="19" border="0"></a></td>
          </tr>
      </table></td>
    </tr>
  <tr> 
    <td height='1' colspan='2' valign='top' bgcolor='#666666'><img src='spacer.gif' width="1" height="1"></td>
  </tr>
</table>

</body>
</html>
User avatar
C_Calav
Forum Contributor
Posts: 395
Joined: Wed Jun 02, 2004 10:55 pm
Location: New Zealand

Post by C_Calav »

going to bed now guys but would be very grateful if someone could help me! had this problem for so long and ive tried to arange it in all sorts of ways but still errors!

i know this topic been covered alot, and i understand in examples but i cant get it to work with my code.

thanks :D
Post Reply