Problème avec header()

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 : Problème avec header()

par albat » 01 avr. 2007, 22:53

Regarde à quel moment tu fais appel à ta fonction redirection()...

Si du code HTML (même une simple espace !) a été affiché, c'est planté !

Rien ne doit précéder un header() !!! ;)

Problème avec header()

par kiss20 » 01 avr. 2007, 22:46

Salut,

J'ai un gros problème avec la fonction header() utiliser pour des redirections.
J'ai ce message d'ereur :
Warning: Cannot modify header information - headers already sent by (output started at c:\site\index.php:13) in c:\site\index.php on line 3
Voici mon code source :

Code : Tout sélectionner

<?php function redirection() { header("Location: index.php?page=result"); exit; } session_start(); echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" > <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> </head>'; /* Ligne 13 */ echo '<style type="text/css"> a { color: #94999d; text-decoration: none; } a:hover { color: #4c5256; } </style> <body> /* Includes */ </body> </html>'; ?>
Je n'arrive pas à trouver mon erreur.
Quelqu'un pourrait m'aider.
Merci