Comment faire plusieurs redirection?

Comment faire plusieurs redirection? - PHP - Programmation

Marsh Posté le 24-02-2005 à 10:24:57    

salut,
 
Apache me renvoit:
 
Warning: Cannot modify header information - headers already sent by (output started at c:\program files\easyphp1-7\www\toto\pages\interface\inc_menu_haut.php:25) in c:\program files\easyphp1-7\www\toto\pages\clients\verifclient.php on line 29
 
Je ne comprend rien du tout dans mon code je ne fais qu'une simple redirection:

Code :
  1. header("Location: http://www.xxx.com/unepage.htm" );


 
Au fait dans tout le site je n ai qu'une autre redirection celle qui concerne index.php afin de renvoyer a la premiere page du site.
 
Merci d avance
 

Reply

Marsh Posté le 24-02-2005 à 10:24:57   

Reply

Marsh Posté le 24-02-2005 à 11:20:00    

lit le message d'erreur et tu comprendras ou ca coince :o


---------------
Nos estans firs di nosse pitite patreye...
Reply

Marsh Posté le 24-02-2005 à 11:23:31    

Citation :

Cannot modify header information - headers already sent by


Les headers sont envoyés avant toute autre information.
 
Donc si tu as le moindre code HTML (ou des "echo" PHP) avant l'envoi d'un header, celui-ci plante.
 
Solutions:
1- placer tous les "header" au tout début des pages
2- activer le buffer de sortie php (il me semble que c'est "ob", output buffer)


---------------
I mean, true, a cancer will probably destroy its host organism. But what about the cells whose mutations allow them to think outside the box, and replicate and expand beyond their wildest dreams by throwing away the limits imposed by overbearing genetic r
Reply

Marsh Posté le 24-02-2005 à 11:34:36    

merci Masklinn :)

Reply

Marsh Posté le 24-02-2005 à 11:54:31    

j ai essayer tous les fonctions ob ca ne donne rien :(.
J ai des echo partout je ne peux les virer :(

Code :
  1. if($ligne)
  2. {
  3. $_SESSION["client_id"]=$ligne["id"];
  4. $_SESSION["client_prenom"]=$ligne["prenom"];
  5. $_SESSION["client_nom"]=$ligne["nom"];
  6. $_SESSION["client_adresse"]=$ligne["adresse"];
  7. $_SESSION["client_tel"]=$ligne["tel"];
  8. $_SESSION["client_portable"]=$ligne["portable"];
  9. $_SESSION["client_mail"]=$ligne["mail"];
  10. $_SESSION["client_cp"]=$ligne["cp"];
  11. $_SESSION["client_ville"]=$ligne["ville"];
  12. $_SESSION["client_civilite"]=$ligne["civilite"];
  13. $_SESSION["client_visible"]=$ligne["visible"];
  14. $_SESSION["client_mdp"]=$ligne["mdp"];
  15. //echo $_SESSION["client_civilite"];
  16. ob_flush();
  17. ob_clean();
  18. ob_start();
  19. header("Location: ../enr_coordonnees.php" );
  20. }
  21. else
  22.         header("Location: ../null.php" );

Reply

Marsh Posté le 24-02-2005 à 11:59:47    

le ob_start doit être en début de page (genre en tout tout début, la première ligne de ton fichier) et un ob_flush + ob_close en toute fin de fichier (après la dernière ligne) [:spamafote]
 
Tout le code (PHP comme HTML) doit être inclus entre ob_start et ob_flush


---------------
I mean, true, a cancer will probably destroy its host organism. But what about the cells whose mutations allow them to think outside the box, and replicate and expand beyond their wildest dreams by throwing away the limits imposed by overbearing genetic r
Reply

Marsh Posté le 24-02-2005 à 12:20:56    

merci Masklinn tu es une star
[:alarmclock2]

Reply

Marsh Posté le 24-02-2005 à 21:53:32    

PETOZAK a écrit :

merci Masklinn tu es une star
[:alarmclock2]


faut pas abuser non plus :)
 
c'est plutot toi qui ne sais pas utiliser les fonctions php
vas sur php.net !

Reply

Marsh Posté le 24-02-2005 à 22:01:06    


 
Oh le vilain jalou!!!! (meme s'il a raison  :bounce: )


---------------
Si la vérité est découverte par quelqu'un d'autre,elle perd toujours un peu d'attrait
Reply

Sujets relatifs:

Leave a Replay

Make sure you enter the(*)required information where indicate.HTML code is not allowed