Warning: Cannot modify header information

Répondre


Cette question est un moyen d’empêcher des soumissions automatisées de formulaires par des robots.
Smileys
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :!: :?: :idea: :arrow: :| :mrgreen: =D> #-o =P~ :^o :non: :priere: 8-|
Voir plus de smileys
  Revue du sujet
 

  Étendre la vue Revue du sujet : Warning: Cannot modify header information

j'ai trouvé

par webmaster_ism_infomaster » 02 mai 2006, 13:29

J'ai trouvé merci de votre aide.Sa venez de ma page commande.php elle de fesai aucun retour c est pour sa que sa m'affiché les erreurs.
Merci de votre aide :D

hum

par webmaster_ism_infomaster » 02 mai 2006, 13:00

Car quand je m'ai dans le header commande.php c ' est le mème topo pourtant j'indique bien la bonne adresse
//----------------------------------------------------COMMANDER 
if ($enregistreCommande=="COMMANDER") 
{ 
    if(!isset($_GET['action'])) 
    $_SESSION['action']="ENREGISTRER";//mémorise l'action 
    header("Location: commande.php"); 
} 
Je sais que le problème vient de là mais ou bonne question.

Re: re

par Truc » 02 mai 2006, 12:24

C'est juste un souci de chemin par rapport au script d'exécution et commande.php.
http://127.0.0.1/shop/panier.php?nb0=commande.php
quand je m'ai dans le header sa, sa me fait plus de message d'erreur mais sa va pas sur ma page commande.php
Si tu met http://www.google.fr... tu n'auras plus l'erreur non plus mais absolument pas la bonne adresse donc normal que tu ne va pas sur la page commande.php

re

par webmaster_ism_infomaster » 02 mai 2006, 01:42

http://127.0.0.1/shop/panier.php?nb0=commande.php
quand je m'ai dans le header sa, sa me fait plus de message d'erreur mais sa va pas sur ma page commande.php

lol

par webmaster_ism_infomaster » 02 mai 2006, 01:09

J'ai fait comme tu ma dit ya une petite amélioration j'ai un petit Impossible de trouver la page - grave que l'erreur précédente :P

par Truc » 02 mai 2006, 00:35

commence par virer ces jointures de balise php qui peuvent cacher des espaces et saut de ligne:
if (isset($_SESSION['liste'])) $liste=$_SESSION['liste'];//recup de la liste de la session
?>

<?php require_once('Connections/shop.php'); ?>
<?php
mysql_select_db($database_shop, $shop); 
en
if (isset($_SESSION['liste'])) $liste=$_SESSION['liste'];//recup de la liste de la session
require_once('Connections/shop.php'); 
mysql_select_db($database_shop, $shop); 

ok je voi pas d'ou vient l'erreur

par webmaster_ism_infomaster » 02 mai 2006, 00:19

ok je voi pas d'ou vient l'erreur j ai régardé je suis novice là je suis largué.
<?php
session_start();
//init des variables
if (!isset($_SESSION['total'])) $_SESSION['total']=0;
if(!isset($_GET['ajoutPanier'])) $ajoutPanier="";//init de ajoutPanier si non déclaré
else  $ajoutPanier=$_GET['ajoutPanier']; 
if(!isset($_GET['modifPanier'])) $modifPanier="";//init de modifPanier si non déclaré
else $modifPanier=$_GET['modifPanier'];
if(!isset($_GET['suppPanier'])) $suppPanier="";//init de suppPanier si non déclaré
else $suppPanier=$_GET['suppPanier'];
if(!isset($_GET['enregistreCommande'])) $enregistreCommande="";//init de enregistreCommande si non déclaré
else $enregistreCommande=$_GET['enregistreCommande'];
if ((!isset($_SESSION['liste']))&&($ajoutPanier=="")) $liste[]=array("VIDE",1,0,0);//init de liste si VIDE
if (isset($_SESSION['liste'])) $liste=$_SESSION['liste'];//recup de la liste de la session
?>

<?php require_once('Connections/shop.php'); ?>
<?php 
mysql_select_db($database_shop, $shop);
//----------------------------------------------------AJOUT PANIER
if ($ajoutPanier=="AJOUTER")
{
	$reference=$_GET['reference'];
	$nb=1; //par défaut la quantité est = 1
	$prix=$_GET['prix'];
	$liste[]=array($reference,$nb,$prix,$prix);
	$_SESSION['liste']=$liste;
	//ajoute un article à la liste
}
//----------------------------------------------------MODIF PANIER
if ($modifPanier=="ACTUALISER")
{
	 for ($i=0;$i<count($liste);$i++)
		{
		$nbi='nb'.$i;
		$liste[$i][1]=$_GET["$nbi"];//recup du nbr d'article dans la liste
		$liste[$i][3]=$liste[$i][1]*$liste[$i][2];//prixArticle=nbre*prixUnitaire
		}
	$_SESSION['liste']=$liste;//mAj de la liste
}
//----------------------------------------------------SUPP PANIER
if ($suppPanier=="SUPPRIMER")
{
	$article=$_GET['article'];
	for ($i=0;$i<count($liste);$i++)
		{
		if($article==$liste[$i][0])
			array_splice($liste,$i,1);
		//suppression de l'article
		}
	$_SESSION['liste']=$liste;//mAj de la liste
}
//----------------------------------------------------COMMANDER
if ($enregistreCommande=="COMMANDER")
{
	if(!isset($_GET['action'])) 
	$_SESSION['action']="ENREGISTRER";//mémorise l'action 
	header("Location: commande.php");
}
 ?>
<?php
mysql_select_db($database_shop, $shop);
$query_rsTheme = "SELECT * FROM rubriques ORDER BY theme ASC";
$rsTheme = mysql_query($query_rsTheme, $shop) or die(mysql_error());
$row_rsTheme = mysql_fetch_assoc($rsTheme);
$totalRows_rsTheme = mysql_num_rows($rsTheme);

$coltitre_rsCatalogue = "meheri";
if (isset($_GET['VARtitre'])) {
  $coltitre_rsCatalogue = (get_magic_quotes_gpc()) ? $_GET['VARtitre'] : addslashes($_GET['VARtitre']);
}
$coltheme_rsCatalogue = "1";
if (isset($_GET['VARtheme'])) {
  $coltheme_rsCatalogue = (get_magic_quotes_gpc()) ? $_GET['VARtheme'] : addslashes($_GET['VARtheme']);
}
mysql_select_db($database_shop, $shop);
$query_rsCatalogue = sprintf("SELECT rubriques.theme, articles.reference, articles.titre, articles.auteur, articles.prix  FROM articles, rubriques WHERE rubriqueID=%s AND rubriques.ID=articles.rubriqueID AND titre LIKE '%%%s%%'", $coltheme_rsCatalogue,$coltitre_rsCatalogue);
$rsCatalogue = mysql_query($query_rsCatalogue, $shop) or die(mysql_error());
$row_rsCatalogue = mysql_fetch_assoc($rsCatalogue);
$totalRows_rsCatalogue = mysql_num_rows($rsCatalogue);

$colreference_rsFiche = "AUTOJMD1";
if (isset($_GET['reference'])) {
  $colreference_rsFiche = (get_magic_quotes_gpc()) ? $_GET['reference'] : addslashes($_GET['reference']);
}
mysql_select_db($database_shop, $shop);
$query_rsFiche = sprintf("SELECT articles.reference, articles.titre, articles.auteur, articles.description, articles.prix, articles.photo, rubriques.theme FROM articles, rubriques WHERE rubriques.ID=articles.rubriqueID AND articles.reference='%s'", $colreference_rsFiche);
$rsFiche = mysql_query($query_rsFiche, $shop) or die(mysql_error());
$row_rsFiche = mysql_fetch_assoc($rsFiche);
$totalRows_rsFiche = mysql_num_rows($rsFiche);
?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<!-- saved from url=(0048)http://css.alsacreations.com/modeles/modele5.htm -->
<HTML lang=fr xml:lang="fr" xmlns="http://www.w3.org/1999/xhtml"><HEAD><TITLE>Achat en ligne de Design et d'application web</TITLE>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<STYLE type=text/css>
BODY {
	PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 0.8em; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif
}
#header {
	HEIGHT: 100%; BACKGROUND-COLOR: #666666}
#conteneur {
	LEFT: 50%; MARGIN-LEFT: -375px; WIDTH: 750px; POSITION: absolute; BACKGROUND-COLOR: #CCCCCC}
#centre {
	MARGIN-LEFT: 150px; MARGIN-RIGHT: 150px; BACKGROUND-COLOR: #999999}
#gauche {
	LEFT: 0px; WIDTH: 150px; POSITION: absolute
}
#droite {
	RIGHT: 0px; WIDTH: 150px; POSITION: absolute
}
#pied {
	HEIGHT: 100%; BACKGROUND-COLOR: #666666}
.menugauche {
	PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px; LIST-STYLE-TYPE: none
}
.menugauche LI {
	MARGIN-BOTTOM: 5px
}
.menugauche A {
	MARGIN: 0px 2px; COLOR: #000000; TEXT-DECORATION: underline
}
.menugauche A:hover {
	TEXT-DECORATION: none
}
.menudroit {
	PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px; LIST-STYLE-TYPE: none
}
.menudroit LI {
	MARGIN-BOTTOM: 5px
}
.menudroit A {
	MARGIN: 0px 2px; COLOR: #000000; TEXT-DECORATION: underline
}
.menudroit A:hover {
	TEXT-DECORATION: none
}
P {
	MARGIN: 0px 0px 10px
}
.Style3 {color: #0099FF; font-weight: bold; }
.Style4 {color: #0000FF}
.Style6 {
	color: #666666;
	font-weight: bold;
}
.Style12 {
	font-size: 14px;
	font-weight: bold;
}
.Style13 {
	color: #000000;
	font-weight: bold;
}
</STYLE>

<META content="MSHTML 6.00.2800.1106" name=GENERATOR></HEAD>
<BODY>
<DIV id=conteneur>
<DIV id=header>
  <div align="left"><em><strong><img src="images/baniere.jpg" width="750" height="65"></strong></em></div>
</DIV>
<DIV id=gauche>
<form name="form1" method="POST">
  <label>
  <div align="center"><strong>E-mail
  </strong>  
    <input name="email" type="text" id="email">
    <strong>Pass
    <input name="pass" type="password" id="pass">
    <input type="submit" name="Submit" value="Connection">
    </strong> </div>
  </label> 
  <br><div align="center"></div>
</form>
<div align="center">
  <div align="center">
    <p><strong>Incription <a href="#">i&ccedil;i</a></strong></p>
    <p><strong>Menu</strong></p>
  </div>
  <div align="center"><strong><a href="index.php">Accueil</a></strong><br>
      <strong><a href="#">KitGraphik</a></strong></div>
</div>
</DIV>
<DIV id=droite>
<form name="form2" method="get" action="rechercher.php">
  <label>
  <div align="center"><strong>Rechercher
  </strong>  
    <input name="VARtitre" type="text" id="VARtitre">
    <input type="submit" name="Submit2" value="Rechercher">
  </div>
  </form>
</DIV>
<DIV id=centre>
  <p align="center">&nbsp;</p>
  <form action="rechercher.php" method="get" name="form3">
    <label> S&eacute;lectionnez
<select name="VARtheme" id="VARtheme">
      <?php
do {  
?>
      <option value="<?php echo $row_rsTheme['ID']?>"><?php echo $row_rsTheme['theme']?></option>
      <?php
} while ($row_rsTheme = mysql_fetch_assoc($rsTheme));
  $rows = mysql_num_rows($rsTheme);
  if($rows > 0) {
      mysql_data_seek($rsTheme, 0);
	  $row_rsTheme = mysql_fetch_assoc($rsTheme);
  }
?>
    </select>
    </label>
    <label>ou saisissez un titre
    <input name="VARtitre" type="text" id="VARtitre" size="10">
    </label>
    <input type="submit" name="Submit3" value="Go">
</form>
  <table width="100%" border="0">
    <!--DWLayoutTable-->
    <tr>
      <td rowspan="6"><div align="center"><img src="./images/<?php echo $row_rsFiche['photo']; ?>"></div></td>
      <td width="107"><div align="right"><strong>Titre:</strong></div></td>
      <td width="272"><?php echo $row_rsFiche['titre']; ?></td>
    </tr>
    <tr>
      <td><div align="right"><strong>Auteur:</strong></div></td>
      <td><?php echo $row_rsFiche['auteur']; ?></td>
    </tr>
    <tr>
      <td><div align="right"><strong>Th&egrave;me:</strong></div></td>
      <td><?php echo $row_rsFiche['theme']; ?></td>
    </tr>
    <tr>
      <td><div align="right"><strong>Descriptif</strong>:</div></td>
      <td><?php echo $row_rsFiche['description']; ?></td>
    </tr>
    <tr>
      <td><div align="right"><strong>Prix:</strong></div></td>
      <td><?php echo $row_rsFiche['prix']; ?>€</td>
    </tr>
    <tr>
      <td height="16" colspan="2" valign="top"><div align="center"><a href="#">L'article &agrave; bien &eacute;t&eacute; rajout&eacute; &agrave; votre caddy </a> </div></td>
    </tr>
  </table>
  <p align="center">&nbsp;</p>
  <table width="100%" border="0" cellspacing="0">
    <tr>
      <td><p align="center">
        <?php if($liste[0][0]!="VIDE") { ?>
          </p>
          <form action="panier.php" method="get" >
            <table width="400" border="1" align="center" cellspacing="0" bordercolor="#0000FF">
              <tr>
                <td><table width="400" border="0" align="center" cellpadding="0" cellspacing="0">
                    <tr bgcolor="#FF0000">
                      <td width="117" bgcolor="#CCCCCC"><div align="center" class="Style13"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Titre</font></div></td>
                      <td width="73" bgcolor="#CCCCCC"><div align="center" class="Style13"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Quantit&eacute;</font></div></td>
                      <td width="128" bgcolor="#CCCCCC"><div align="center" class="Style13"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Prix</font></div></td>
                      <td width="82" bgcolor="#CCCCCC"><div align="center" class="Style13"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Supp</font></div></td>
                    </tr>
                    <?php
		   $total=0.00;
  for ($i=0;$i<count($liste);$i++)
{
	$query_rsPanier="select * from articles where reference = '".$liste[$i][0]."'";
	//echo $query_rsPanier;
	$rsPanier = mysql_query($query_rsPanier, $shop) or die(mysql_error());
    $row_rsPanier = mysql_fetch_assoc($rsPanier);		
	?>
                    <tr>
                      <td width="117"><div align="center"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><?php echo $row_rsPanier['titre'] ?></font></div></td>
                      <td width="73"><div align="center">
                          <select name="nb<?php echo $i?>">
                            <option value="1"  <?php if($liste[$i][1]==1) echo "SELECTED"; ?>>1</option>
                            <option value="2" <?php if($liste[$i][1]==2) echo "SELECTED"; ?>>2</option>
                            <option value="3" <?php if($liste[$i][1]==3) echo "SELECTED"; ?>>3</option>
                          </select>
                      </div></td>
                      <td width="128"><div align="center"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><?php echo $row_rsPanier['prix'] ?></font></div></td>
                      <td><div align="center"><a href="panier.php?suppPanier=SUPPRIMER&article=<?php echo $row_rsPanier['reference'] ?>"><img src="images/Next.gif" alt="d" width="14" height="13" border="0"></a></div></td>
                    </tr>
                    <?php
 	
	$total+=$row_rsPanier['prix'] * $liste[$i][1];
}
$_SESSION['total']=$total;//mAj du total dans la session

?>
                    <tr>
                      <td width="117" ><div align="center"></div></td>
                      <td width="73" ><div align="center"></div></td>
                      <td width="128" ><div align="center"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong>Total 
                      : <?php echo $total ?> Euros</strong></font></div></td>
                      <td ><div align="center"></div></td>
                    </tr>
                </table></td>
              </tr>
            </table>
            <br>
            <p align="center">
              <input type="submit" name="modifPanier" value="ACTUALISER">
              <input name="enregistreCommande" type="Submit" value="COMMANDER">
            </p>
          </form>
		   <?php } else { ?>
          <p align="center" class="Style12"><font face="Verdana, Arial, Helvetica, sans-serif">Votre panier est vide </font></p>
          <?php }?>
      </td>
    </tr>
  </table>
  <p align="center">&nbsp;</p>
  <p align="center">&nbsp;</p>
  <p><BR>
  </p>
  </DIV>
<DIV id=pied>
  <div align="center">&copy;2005-2006 Ism-Infomaster.com | Tous droits r&eacute;serv&eacute;s</div>
</DIV>
</DIV>
</BODY></HTML>
<?php
mysql_free_result($rsTheme);

mysql_free_result($rsCatalogue);

mysql_free_result($rsFiche);
?>

par iclo » 01 mai 2006, 23:20

C'est une question qui revient souvent.
Une petite recherche sur le forum t'aurait conduit vers : http://www.phpfrance.com/forums/voir_su ... er+bug.php

Warning: Cannot modify header information

par webmaster_ism_infomaster » 01 mai 2006, 22:31

J'ai une erreur de ce type que ne connait pas Warning: Cannot modify header information - headers already sent by (output started at c:\program files\easyphp1-8\www\shop\panier.php:17) in c:\program files\easyphp1-8\www\shop\panier.php on line 58
if ($enregistreCommande=="COMMANDER")
{
	if(!isset($_GET['action'])) 
	$_SESSION['action']="ENREGISTRER";//mémorise l'action 
	header("Location: commande.php");
Merci de votre aide