IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Langage PHP Discussion :

Cannot modify header information


Sujet :

Langage PHP

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre averti
    Homme Profil pro
    Étudiant
    Inscrit en
    Juin 2012
    Messages
    17
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Canada

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Juin 2012
    Messages : 17
    Par défaut Cannot modify header information
    bonjour, j'ai une erreur après avoir ajouter le style au formulaire dans une page php et le formulaire ne répond plus.


    Warning: Cannot modify header information - headers already sent by (output started at /home2/fafaremi/public_html/blessed-matrimony.ca/inscription/Projet1/Question3.php:10) in /home2/fafaremi/public_html/blessed-matrimony.ca/inscription/Projet1/Question3.php on line 75

    voici le code :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    <?php
    session_start( );
    ?>
    <html>
    <head>
    <meta http-equiv='Content-Type' content='text/html; charset=utf-8'>
    <meta charset='UTF-8' />
    <link rel='stylesheet' href='/css/inscription.css' />
    </head>
    <?php
    /*$db_host = "127.0.0.1";
    $db_user = "fafaremi_jan";
    $db_name = "fafaremi_angelique";
    $db_pass = "abc123";*/
     
    /*$db_host = "127.0.0.1";
    $db_user = "root";
    $db_name = "USERS";
    $db_pass = "abc123";
    
    function connection(){
    global $db_host,$db_user,$db_name,$db_pass;
    $connectId = mysql_connect($db_host,$db_user,$db_pass)or die(mysql_error());
    mysql_select_db("$db_name",$connectId)or die(mysql_error());
    
    if(!$connectId){
      return -1;
    }
    else if(!mysql_select_db($db_name))
    {
      return -1;
    }
    else
    {
      return $connectId;
    }
    
    function disconnect($connectId){
    return mysql_close($connectId);
    }
    }*/
     
    include_once('dbConnect.php');
     
     
    //$con = connection();
     
    // pour message d'erreur undefine compt
     
    @$_SESSION['compt']++;
    //$_SESSION['compt'] = (isset($_SESSION['compt'])) ? $_SESSION['compt'] + 1 : 1;
     
    //$_SESSION['compt']= $_SESSION['compt'] + 1;
    $_SESSION['food_id']=2;
     
    //echo $_SESSION['food_id'];
     
    if(!empty($_POST['txtFname'])){
    $sql = "INSERT INTO invites(nom, prenom, gender, menu, P_id, Allergie) 
        values('".$_POST['txtName'] ."','".$_POST['txtFname']."','".$_POST['radGenre']."','".$_POST['cboMenu']."', ".$_SESSION['PID']."
    	,'".$_POST['txtAllergie']."')";
     
    $_SESSION['nom'] = $_POST['txtName'];
    $_SESSION['prenom'] = $_POST['txtFname'] ;
     
    $result = mysql_query($sql);
     
     mysql_close();
     
     $invites = $_SESSION['nbInvites']+1; 
     
    if($_SESSION['compt']== $invites)
    {
        //session_destroy();
        header("Location: Question4.htm");
    	//exit;
    }
    }
    else{$_SESSION['compt']=0;}
    ?>
    <br/><br/><br/><br/><br/>
    <div class="container">
     
    <div class="navbar">
        <div class="navbar-inner">
          <div class="container">
            <a class="brand" href="http://blessed-matrimony.ca/inscription/">R&eacute;servation</a>
          </div>
        </div><!-- /navbar-inner -->
    </div>
     
    <?php
    /*******************************/
    //$invites = $_SESSION['nbInvites']+1 ;
    if(isset($_POST['txtFname'])){$test=$_SESSION['food_id'];}else{$test=0;}
     
    //echo $test."-".$_SESSION['compt']."/".$invites."-";
     
        if($test == 0){
            echo "<p class='question'><br><br>3) Votre r&eacute;servation :</p>";
    		/*echo "<p align='left'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    		&nbsp;&nbsp;&nbsp;&nbsp;
    		<img src='image31.jpg' /></p>";*/
        }
        else{ 
            echo "<p class='question'><br><br>3) Vos invit&eacute;s : </p>";
    		//echo "<img src='image32.jpg' />";
     
        }	
     
    //echo "<br/><br/><br/><br/><br/><br/>";	
     
    //echo "<div style='float:left'>";
     
    echo "<form name='frmInvitation' id='frmInvitation' caption='Question3.php' method='post'>";
     
    /*echo "<table>";
    	
    	echo "<tr>";
    	echo "<td rowspan='10' colspan='50'></td>";
    	echo "</tr>";
    	
    	echo "<tr>";
    	echo "<td>";*/
     
    	//for($i=0; $i<$inviter; $i++){
     
    echo "<table border='0'>";
     
    		echo "<tr>";
    			echo "<td style='font-size: 16px;'>Nom : </td>";
    			echo "<td style='font-size: 16px;'>&nbsp&nbsp&nbsp&nbsp&nbsp<input name='txtName' type='text' /></td>";
    		echo "</tr>";
    		echo "<tr>";
    			echo "<td style='font-size: 16px;'>Pr&eacute;nom : </td>";
    			echo "<td>&nbsp&nbsp&nbsp&nbsp&nbsp<input name='txtFname' type='text' /></td>";
    		echo "</tr>";
    		echo "<tr>";
    			echo "<td style='font-size: 16px;'><input  style='font-size: 16px;' name='radGenre' type='radio' value='Adulte' checked='true'/>Adulte</td>";
    			echo "<td style='font-size: 16px;'>&nbsp&nbsp&nbsp&nbsp&nbsp<input name='radGenre' type='radio' value='Enfant' />Enfant
    			</td>";
    		echo "</tr>";
    		echo "<tr>";
    			echo "<td><br/></td>";
    		echo "</tr>";
    echo "</table>";
    echo "<table>";
    		echo "<tr>";
    			echo "<td colspan='2' style='font-size: 16px;'><p>Choix du menu : </p></td>";
    		echo "</tr>";
    		echo "<tr>";
    			echo "<td><select name='cboMenu'>";
    			echo "<option value='Filet de porc aux canneberges du rang St-Albert'>
    			Filet de porc aux canneberges du rang St-Albert</option>";
    			echo "<option value='Poulet farci au prosciutto, sauce crême, vinaigre de vin blanc et sauge'>
    			Poulet farci au prosciutto, sauce cr&ecirc;me, vinaigre de vin blanc et sauge</option>";
    			echo "<option value='Tournedos de saumon de Nouvelle-ecosse, salsa de fenouil au citron et aux herbes'>
    			Tournedos de saumon de Nouvelle-ecosse, salsa de fenouil au citron et aux herbes</option>";
    			echo "<option value='Menu enfant'>Menu enfant</option>";
    			echo "</select></td>";
    			echo "<td></td>";
    		echo "</tr>";
    		echo "<tr>";
    			echo "<td colspan='2' style='font-size: 16px;'><br>&Ecirc;tes-vous allergique &agrave; certains aliments? Si oui, veuillez l'indiquer. </td>";
    			//echo "<td><img src='image33.jpg' /></td>";
    		echo "</tr>";
    		echo "<tr>";
    			echo "<td colspan='2'><input name='txtAllergie' type='text' value='Aucune'></td>";
    		echo "</tr>";
    	/*	echo "</tr>";
    			// enregistrer l'inviter d'abord.
                    echo "<td><br><input name='btnAjouter' type='submit' value='Ajouter' />";
                    echo "&nbsp&nbsp&nbsp&nbsp&nbsp";
                    //echo "<input name='btnTerminer' type='button' value='Terminer' onclick='' /></td>";
    		echo "</tr>"; */
     
    echo "</table>";
     
    /*echo "</td>";
    echo "</tr>";
    		
    echo "</table>";
    
    echo "</form>";*/
     
    /*echo "</div>";
    
    echo "<div style='float:right; margin-right:20px'>";
    	 echo"<img src='IMG_1921_3_2.jpg' />";
    echo "</div>";*/
     
    echo "</br></br>";
    ?>
    		<div class="form-actions">
    <button class="btn btn-warning pull-right" name="btnAjouter"> Valider <i class="icon-circle-arrow-right icon-white"></i></button>
    </div>
    	<!--	<input name="btnValider" type="submit" value="Valider" class="btn btn-warning pull-right " /> -->
    	</form>
    </div>
     
    </body>
    </html>

  2. #2
    Modérateur
    Avatar de sabotage
    Homme Profil pro
    Inscrit en
    Juillet 2005
    Messages
    29 208
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations forums :
    Inscription : Juillet 2005
    Messages : 29 208
    N'oubliez pas de consulter les FAQ PHP et les cours et tutoriels PHP

  3. #3
    Modérateur
    Avatar de Vil'Coyote
    Homme Profil pro
    Développeur adélia & Web
    Inscrit en
    Février 2008
    Messages
    4 583
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 44
    Localisation : France, Isère (Rhône Alpes)

    Informations professionnelles :
    Activité : Développeur adélia & Web
    Secteur : Industrie

    Informations forums :
    Inscription : Février 2008
    Messages : 4 583
    Par défaut
    la redirection ne marche que si rien n'est chargé dans ta page. hors ici tu charge dès le début les balises html etc ... donc erreur.
    la vie n'est pas cirrhose des foies ...

    Avant de poster un message Rechercher n'est pas qu'une option.
    FAQ Web - Tuto Web

Discussions similaires

  1. Cannot modify header information
    Par Belebostre dans le forum Langage
    Réponses: 10
    Dernier message: 23/09/2006, 09h05
  2. Cannot modify header information
    Par nerixm dans le forum Langage
    Réponses: 4
    Dernier message: 19/09/2006, 22h29
  3. Réponses: 5
    Dernier message: 04/09/2006, 15h13
  4. Cannot modify header information
    Par rane dans le forum Langage
    Réponses: 5
    Dernier message: 29/03/2006, 14h32
  5. Warning: Cannot modify header information
    Par neXistPa dans le forum Langage
    Réponses: 9
    Dernier message: 16/02/2006, 12h22

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo