Php

Bonjour,
j'ai toujours un probleme a chaque fois si je valide il menvoie ceci
Warning: Cannot modify header information - headers already sent by (output started at C:\Program Files\EasyPHP 2.0b1\www\gestion_stage\create\index.php:104) in C:\Program Files\EasyPHP 2.0b1\www\gestion_stage\create\tFrmDomaines.php on line 36
et mon code tt est normal
voila mon code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Document sans titre</title>
</head>

<body>

<?php
//session_start();
if(!isset($_POST['enregistrer']))
include_once('frmDomaines.php');
else
{
require_once('connexion.php');
extract($_POST);
$sql="insert into domaine (numero_domaine, nom_domaine) values ('', '$dom')";
$exe=mysql_query($sql, $db) or die(mysql_error());
$numdom=mysql_insert_id();
if(!$exe)
exit;
foreach($_SESSION['tab'] as $val)
{
$tab=explode(';', $val);
$sql="insert into definircritere (numero_domaine, numcritere, standard) values ($numdom, ".$tab[0].", '".$tab[2]."')";
$exe=mysql_query($sql, $db) or die(mysql_error());
}
foreach($_SESSION['obj'] as $val)
{
$tab=explode(';', $val);
$sql="insert into fixer (numero_domaine, numobj) values ($numdom, ".$tab[0].")";
$exe=mysql_query($sql, $db) or die(mysql_error());
}
if($exe)
header('location:confirm.php?val=dom');
else
header('location:error.php');
}
?>

</body>
</html>
si quelqu'un a une solution pour cela
Configuration: Windows Vista
Safari 530.17

2 réponses

  1. //session_start();
    if(!isset($_POST['enregistrer']))
    include_once('frmDomaines.php');


    2 questions:
    - pourquoi as tu mis session_start() en commentaire alors que tu utilises $_SESSION plu sbas

    - est ce que frmDomaines.php ne contiendrait pas par hasard du code html ?
    1. frmdomaines.php je lai ajoute que php
      mais si jutilise wamppserver ca pace normal sans blame
      je tranfere ce dossier sur easyphp2.O il me pose mm probleme
  2. le header doit être envoyé AVANT TOUTE BALISE ou caratere HTMl

    donc:

    <?php
    session_start();
    if(!isset($_POST['enregistrer']))
    include_once('frmDomaines.php');
    else
    {
    require_once('connexion.php');
    extract($_POST);
    $sql="insert into domaine (numero_domaine, nom_domaine) values ('', '$dom')";
    $exe=mysql_query($sql, $db) or die(mysql_error());
    $numdom=mysql_insert_id();
    if(!$exe)
    exit;
    foreach($_SESSION['tab'] as $val)
    {
    $tab=explode(';', $val);
    $sql="insert into definircritere (numero_domaine, numcritere, standard) values ($numdom, ".$tab[0].", '".$tab[2]."')";
    $exe=mysql_query($sql, $db) or die(mysql_error());
    }
    foreach($_SESSION['obj'] as $val)
    {
    $tab=explode(';', $val);
    $sql="insert into fixer (numero_domaine, numobj) values ($numdom, ".$tab[0].")";
    $exe=mysql_query($sql, $db) or die(mysql_error());
    }
    if($exe)
    header('location:confirm.php?val=dom');
    else
    header('location:error.php');
    }
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Document sans titre</title>
    </head>
    
    <body>
    
    
    
    </body>
    </html>
    1. g modifie mais c toujour mm probleme mm ceci
      Warning: Cannot modify header information - headers already sent by (output started at C:\Program Files\EasyPHP 2.0b1\www\gestion_stage\create\index.php:104) in C:\Program Files\EasyPHP 2.0b1\www\gestion_stage\create\tFrmDomaines.php on line 27
      voici la code
      <?php
      //session_start();
      if(!isset($_POST['enregistrer']))
      include_once('frmDomaines.php');
      else
      {
      require_once('connexion.php');
      extract($_POST);
      $sql="insert into domaine (numero_domaine, nom_domaine) values ('', '$dom')";
      $exe=mysql_query($sql, $db) or die(mysql_error());
      $numdom=mysql_insert_id();
      if(!$exe)
      exit;
      foreach($_SESSION['tab'] as $val)
      {
      $tab=explode(';', $val);
      $sql="insert into definircritere (numero_domaine, numcritere, standard) values ($numdom, ".$tab[0].", '".$tab[2]."')";
      $exe=mysql_query($sql, $db) or die(mysql_error());
      }
      foreach($_SESSION['obj'] as $val)
      {
      $tab=explode(';', $val);
      $sql="insert into fixer (numero_domaine, numobj) values ($numdom, ".$tab[0].")";
      $exe=mysql_query($sql, $db) or die(mysql_error());
      }
      if($exe)
      header('location:confirm.php?val=dom');
      else
      header('location:error.php');
      }
      ?>