Problème avec fonction fopen
drogba7213
Messages postés
1550
Statut
Membre
-
drogba7213 Messages postés 1550 Statut Membre -
drogba7213 Messages postés 1550 Statut Membre -
Bonjour,
j'ai un petit soucis avec la fonction fopen
voici mon script
$fp = fopen("..site/stage/fichier.txt","a");
fputs($fp, "\n"); // on va a la ligne
fputs($fp, "nom | prenom
fputs($fp, $_POST['nom']." | ".$_POST['prenom']);
fclose($fp);
Voici les erreurs qui me renvoie :
Warning: fopen(..site/stage/fichier.txt) [function.fopen]: failed to open stream: No such file or directory in /mnt/104/sdb/7/8/site.inter/stage/concours_ts.php on line 42
Warning: fputs(): supplied argument is not a valid stream resource in /mnt/104/sdb/7/8/site.inter/stage/concours_ts.php on line 43
Warning: fputs(): supplied argument is not a valid stream resource in /mnt/104/sdb/7/8/site.inter/stage/concours_ts.php on line 44
Warning: fputs(): supplied argument is not a valid stream resource in /mnt/104/sdb/7/8/site.inter/stage/concours_ts.php on line 45
Warning: fclose(): supplied argument is not a valid stream resource in /mnt/104/sdb/7/8/site.inter/stage/concours_ts.php on line 46
Pouvez vous m'aidez svp
Merci d'avance
j'ai un petit soucis avec la fonction fopen
voici mon script
$fp = fopen("..site/stage/fichier.txt","a");
fputs($fp, "\n"); // on va a la ligne
fputs($fp, "nom | prenom
fputs($fp, $_POST['nom']." | ".$_POST['prenom']);
fclose($fp);
Voici les erreurs qui me renvoie :
Warning: fopen(..site/stage/fichier.txt) [function.fopen]: failed to open stream: No such file or directory in /mnt/104/sdb/7/8/site.inter/stage/concours_ts.php on line 42
Warning: fputs(): supplied argument is not a valid stream resource in /mnt/104/sdb/7/8/site.inter/stage/concours_ts.php on line 43
Warning: fputs(): supplied argument is not a valid stream resource in /mnt/104/sdb/7/8/site.inter/stage/concours_ts.php on line 44
Warning: fputs(): supplied argument is not a valid stream resource in /mnt/104/sdb/7/8/site.inter/stage/concours_ts.php on line 45
Warning: fclose(): supplied argument is not a valid stream resource in /mnt/104/sdb/7/8/site.inter/stage/concours_ts.php on line 46
Pouvez vous m'aidez svp
Merci d'avance
A voir également:
- Problème avec fonction fopen
- Fonction si et - Guide
- Fonction miroir - Guide
- Fonction moyenne excel - Guide
- Fonction remplacer sur word - Guide
- Fonction somme excel - Guide
3 réponses
("..site/stage/fichier.txt","a"); ->("site/stage/fichier.txt","a+");
je sais pas si il cree les dossiers par lui meme.... ->("fichier.txt","a+"); comme ca tu aura le fichier dans le meme repertoire
je sais pas si il cree les dossiers par lui meme.... ->("fichier.txt","a+"); comme ca tu aura le fichier dans le meme repertoire
juste pour vous tenir informé j'ai réussit
alors si des personnes cherche comment faire je laisse mon script
Code : PHP
$nom = $_POST['nom'];
$prenom = $_POST['prenom'];
$naissance = $_POST['naissance'];
$lieu = $_POST['lieu'];
$dpt = $_POST['dpt'];
$adresse = $_POST['adresse'];
$tel = $_POST['telephone'];
$telecopie = $_POST['telecopie'];
$port = $_POST['portable'];
$mail = $_POST['mail'];
$c1 = $_POST['classe'];
$o1 = $_POST['option'];
$a1 = $_POST['annee'];
$c2 = $_POST['classe2'];
$o2 = $_POST['option2'];
$a2 = $_POST['annee2'];
$c3 = $_POST['classe3'];
$o3 = $_POST['option3'];
$a3 = $_POST['annee3'];
$c4 = $_POST['classe4'];
$o4 = $_POST['option4'];
$a4 = $_POST['annee4'];
$c5 = $_POST['classe5'];
$o5 = $_POST['option5'];
$a5 = $_POST['annee5'];
$c6 = $_POST['classe6'];
$o6 = $_POST['option6'];
$a6 = $_POST['annee6'];
$c7 = $_POST['classe7'];
$o7 = $_POST['option7'];
$a7 = $_POST['annee7'];
$c8 = $_POST['classe8'];
$o8 = $_POST['option8'];
$a8 = $_POST['annee8'];
$m1 = $_POST['mention'];
$a9 = $_POST['annee9'];
$m2 = $_POST['mention2'];
$a10 = $_POST['annee10'];
//écriture depuis fin du fichier
$fp = fopen("fichier.txt","a+");
fputs($fp, "\n"); // on va a la ligne
fputs($fp, "nom | prenom | naissance | lieu | dpt | adresse | telephone | telecopie | portable | mail | classe | option | annee | classe2 | option2 | annee2 | classe3 | option3 | annee3 | classe4 | option4 | annee4 | classe5 | option5 | annee5 | classe6 | option6 | annee6 | classe7 | option7 | annee7 | classe8 | option8 | annee8 | mention | annee9 | mention2 | annee10 \n"); // on écrit dans le fichier
fputs($fp, "$nom | $prenom | $naissance | $lieu | $dpt | $adresse | $tel | $telecopie | $port | $mail | $c1 | $o1 | $a1 | $c2 | $o2 | $a2 | $c3 | $o3 | $a3 | $c4 | $o4 | $a4 | $c5 | $o5 | $a5 | $c6 | $o6 | $a6 | $c7 | $o7 | $a7 | $c8 | $o8 | $a8 | $m1 | $a9 | $m2 | $a10 ");
fclose($fp);
Par contre j'ai un autre soucis et il est de taille le problème est que quand on remplit le formulaire sous internet explorer pas de problème par contre sous firefox rien ne rentre auriez vous une manip svp?
alors si des personnes cherche comment faire je laisse mon script
Code : PHP
$nom = $_POST['nom'];
$prenom = $_POST['prenom'];
$naissance = $_POST['naissance'];
$lieu = $_POST['lieu'];
$dpt = $_POST['dpt'];
$adresse = $_POST['adresse'];
$tel = $_POST['telephone'];
$telecopie = $_POST['telecopie'];
$port = $_POST['portable'];
$mail = $_POST['mail'];
$c1 = $_POST['classe'];
$o1 = $_POST['option'];
$a1 = $_POST['annee'];
$c2 = $_POST['classe2'];
$o2 = $_POST['option2'];
$a2 = $_POST['annee2'];
$c3 = $_POST['classe3'];
$o3 = $_POST['option3'];
$a3 = $_POST['annee3'];
$c4 = $_POST['classe4'];
$o4 = $_POST['option4'];
$a4 = $_POST['annee4'];
$c5 = $_POST['classe5'];
$o5 = $_POST['option5'];
$a5 = $_POST['annee5'];
$c6 = $_POST['classe6'];
$o6 = $_POST['option6'];
$a6 = $_POST['annee6'];
$c7 = $_POST['classe7'];
$o7 = $_POST['option7'];
$a7 = $_POST['annee7'];
$c8 = $_POST['classe8'];
$o8 = $_POST['option8'];
$a8 = $_POST['annee8'];
$m1 = $_POST['mention'];
$a9 = $_POST['annee9'];
$m2 = $_POST['mention2'];
$a10 = $_POST['annee10'];
//écriture depuis fin du fichier
$fp = fopen("fichier.txt","a+");
fputs($fp, "\n"); // on va a la ligne
fputs($fp, "nom | prenom | naissance | lieu | dpt | adresse | telephone | telecopie | portable | mail | classe | option | annee | classe2 | option2 | annee2 | classe3 | option3 | annee3 | classe4 | option4 | annee4 | classe5 | option5 | annee5 | classe6 | option6 | annee6 | classe7 | option7 | annee7 | classe8 | option8 | annee8 | mention | annee9 | mention2 | annee10 \n"); // on écrit dans le fichier
fputs($fp, "$nom | $prenom | $naissance | $lieu | $dpt | $adresse | $tel | $telecopie | $port | $mail | $c1 | $o1 | $a1 | $c2 | $o2 | $a2 | $c3 | $o3 | $a3 | $c4 | $o4 | $a4 | $c5 | $o5 | $a5 | $c6 | $o6 | $a6 | $c7 | $o7 | $a7 | $c8 | $o8 | $a8 | $m1 | $a9 | $m2 | $a10 ");
fclose($fp);
Par contre j'ai un autre soucis et il est de taille le problème est que quand on remplit le formulaire sous internet explorer pas de problème par contre sous firefox rien ne rentre auriez vous une manip svp?