Problème pour créer des cookies
bruno
-
Makari -
Makari -
Bonjour,
Je suis entrain de développer une page de réservation pour un site.
La page contient un formulaire et je commence la page qui reçoit le formulaire en créant des cookies avec les données afin que les informations soient conservées, si l'on retourne à la page de saisie du formulaire.
je commence donc cette page comme cela
<?php
// Création des cookies pour se souvenir du formulaire en cas d'erreur
if (isset($_POST['nom'])) setcookie('nom',$_POST['nom'],time()+36000);
if (isset($_POST['prenom'])) setcookie('prenom',$_POST['prenom'],time()+36000);
if (isset($_POST['telephone'])) setcookie('telephone',$_POST['telephone'],time()+36000);
if (isset($_POST['email'])) setcookie('email',$_POST['email'],time()+36000);
if (isset($_POST['adresse1'])) setcookie('adresse1',$_POST['adresse1'],time()+36000);
if (isset($_POST['adresse2'])) setcookie('adresse2',$_POST['adresse2'],time()+36000);
if (isset($_POST['postal'])) setcookie('postal',$_POST['postal'],time()+36000);
if (isset($_POST['ville'])) setcookie('ville',$_POST['ville'],time()+36000);
?>
Cela fonctionne trés bien sur firefox, mais sur internet explorer j'ai les erreurs suivantes :
Warning: Cannot modify header information - headers already sent by (output started at /home.10.29/opusoper/www/reservations.php:1) in /home.10.29/opusoper/www/reservations.php on line 3
Warning: Cannot modify header information - headers already sent by (output started at /home.10.29/opusoper/www/reservations.php:1) in /home.10.29/opusoper/www/reservations.php on line 4
Warning: Cannot modify header information - headers already sent by (output started at /home.10.29/opusoper/www/reservations.php:1) in /home.10.29/opusoper/www/reservations.php on line 5
Warning: Cannot modify header information - headers already sent by (output started at /home.10.29/opusoper/www/reservations.php:1) in /home.10.29/opusoper/www/reservations.php on line 6
Warning: Cannot modify header information - headers already sent by (output started at /home.10.29/opusoper/www/reservations.php:1) in /home.10.29/opusoper/www/reservations.php on line 7
Warning: Cannot modify header information - headers already sent by (output started at /home.10.29/opusoper/www/reservations.php:1) in /home.10.29/opusoper/www/reservations.php on line 8
Warning: Cannot modify header information - headers already sent by (output started at /home.10.29/opusoper/www/reservations.php:1) in /home.10.29/opusoper/www/reservations.php on line 9
Warning: Cannot modify header information - headers already sent by (output started at /home.10.29/opusoper/www/reservations.php:1) in /home.10.29/opusoper/www/reservations.php on line 10
J'ai lu plusieurs forum ou il est expliqué qu'il faut créer les cookies en tout début de page. C'est ce que j'ai fait.
Quelqun peut il m'aider ?
Je suis entrain de développer une page de réservation pour un site.
La page contient un formulaire et je commence la page qui reçoit le formulaire en créant des cookies avec les données afin que les informations soient conservées, si l'on retourne à la page de saisie du formulaire.
je commence donc cette page comme cela
<?php
// Création des cookies pour se souvenir du formulaire en cas d'erreur
if (isset($_POST['nom'])) setcookie('nom',$_POST['nom'],time()+36000);
if (isset($_POST['prenom'])) setcookie('prenom',$_POST['prenom'],time()+36000);
if (isset($_POST['telephone'])) setcookie('telephone',$_POST['telephone'],time()+36000);
if (isset($_POST['email'])) setcookie('email',$_POST['email'],time()+36000);
if (isset($_POST['adresse1'])) setcookie('adresse1',$_POST['adresse1'],time()+36000);
if (isset($_POST['adresse2'])) setcookie('adresse2',$_POST['adresse2'],time()+36000);
if (isset($_POST['postal'])) setcookie('postal',$_POST['postal'],time()+36000);
if (isset($_POST['ville'])) setcookie('ville',$_POST['ville'],time()+36000);
?>
Cela fonctionne trés bien sur firefox, mais sur internet explorer j'ai les erreurs suivantes :
Warning: Cannot modify header information - headers already sent by (output started at /home.10.29/opusoper/www/reservations.php:1) in /home.10.29/opusoper/www/reservations.php on line 3
Warning: Cannot modify header information - headers already sent by (output started at /home.10.29/opusoper/www/reservations.php:1) in /home.10.29/opusoper/www/reservations.php on line 4
Warning: Cannot modify header information - headers already sent by (output started at /home.10.29/opusoper/www/reservations.php:1) in /home.10.29/opusoper/www/reservations.php on line 5
Warning: Cannot modify header information - headers already sent by (output started at /home.10.29/opusoper/www/reservations.php:1) in /home.10.29/opusoper/www/reservations.php on line 6
Warning: Cannot modify header information - headers already sent by (output started at /home.10.29/opusoper/www/reservations.php:1) in /home.10.29/opusoper/www/reservations.php on line 7
Warning: Cannot modify header information - headers already sent by (output started at /home.10.29/opusoper/www/reservations.php:1) in /home.10.29/opusoper/www/reservations.php on line 8
Warning: Cannot modify header information - headers already sent by (output started at /home.10.29/opusoper/www/reservations.php:1) in /home.10.29/opusoper/www/reservations.php on line 9
Warning: Cannot modify header information - headers already sent by (output started at /home.10.29/opusoper/www/reservations.php:1) in /home.10.29/opusoper/www/reservations.php on line 10
J'ai lu plusieurs forum ou il est expliqué qu'il faut créer les cookies en tout début de page. C'est ce que j'ai fait.
Quelqun peut il m'aider ?
A voir également:
- Problème pour créer des cookies
- Créer un lien pour partager des photos - Guide
- Comment créer un groupe whatsapp - Guide
- Créer un compte google - Guide
- Créer un compte gmail - Guide
- Creer un fichier .bat - Guide
3 réponses
Rectification :
Cela marche en local avec easyphp avec mozilla comme internet exlorer, mais cela ne marche pas en ligne hébergé par ovh.
Si il s'agit de la confoig du serveur, que dois je faire ?
Merci
Cela marche en local avec easyphp avec mozilla comme internet exlorer, mais cela ne marche pas en ligne hébergé par ovh.
Si il s'agit de la confoig du serveur, que dois je faire ?
Merci