Aide please !

Résolu
cs_vinz78 Messages postés 207 Date d'inscription jeudi 24 mai 2007 Statut Membre Dernière intervention 24 juillet 2007 - 25 mai 2007 à 11:48
cs_vinz78 Messages postés 207 Date d'inscription jeudi 24 mai 2007 Statut Membre Dernière intervention 24 juillet 2007 - 25 mai 2007 à 13:45
Voila je souhaite envoyer les données d'un formulaire vers un fichier texte déja existant j'ai trouvé un code pour envoyer les champs de mon formulaire cependant j'aimerai egalement envoyer ce qu'il y a avant le champ par exemple dan mon form j'ai Nom : Mr X  mon fichier texte ne prend que Mr X quel est le code pour qu'il prenne ce qu'il y a avant les :
merci

voila mon fichier texte

-Client       
nom :
adresse :
telephone :
              
-Matériel     
Marque :
Modele :
CPU :
Ram :
OS :
IE :
Connexion :
Utilisateur :
              
-Baseteams    
Type :
Matricule :
Soc :
Profil :
Version :
Repertoire :
              
-Interventions
Typeint :
Date :
Numcacao :
Duree :
Transport :
Montantfrais :
Intervenant :
Nomlab :

voila mon code pour passé du form au text

<?php
$nom=$HTTP_POST_VARS['nom'];
$adresse=$HTTP_POST_VARS['adresse'];
$telephone=$HTTP_POST_VARS['telephone'];
$marque=$HTTP_POST_VARS['Marque'];
$modele=$HTTP_POST_VARS['Modele'];
$CPU=$HTTP_POST_VARS['CPU'];
$Ram=$HTTP_POST_VARS['Ram'];
$OS=$HTTP_POST_VARS['OS'];
$IE=$HTTP_POST_VARS['IE'];
$connexion=$HTTP_POST_VARS['Connexion'];
$utilisateur=$HTTP_POST_VARS['Utilisateur'];
$type=$HTTP_POST_VARS['Type'];
$matricule=$HTTP_POST_VARS['Matricule'];
$soc=$HTTP_POST_VARS['Soc'];
$profil=$HTTP_POST_VARS['Profil'];
$version=$HTTP_POST_VARS['Version'];
$repertoire=$HTTP_POST_VARS['Repertoire'];
$typeint=$HTTP_POST_VARS['Typeint'];
$date=$HTTP_POST_VARS['Date'];
$numcacao=$HTTP_POST_VARS['Numcacao'];
$duree=$HTTP_POST_VARS['Duree'];
$transport=$HTTP_POST_VARS['Transport'];
$montantfrais=$HTTP_POST_VARS['Montantfrais'];
$intervenant=$HTTP_POST_VARS['Intervenant'];
$nomlab=$HTTP_POST_VARS['Nomlab'];

$fp= fopen ("Nouveau Document texte.txt","a+");
foreach($HTTP_POST_VARS as $value)
fwrite($fp,$value ."\r\n");
?>

et pour finir mon form

<html>

<head>
Formulaire de données

</head>
<form method="post" action="page2test.php">
Client : ,

----

    Nom,
    ,

----

    Adresse,
    ,

----

    Téléphone,
    ,

----

Matériel :,

----

    Marque,
    ,

----

    Modele,
    ,

----

    CPU,
    ,

----

    Ram,
    ,

----

    OS,
    ,

----

    IE,
    ,

----

    Connexion,
    ,

----

    Utilisateur,
    ,

----

Baseteams :,

----

    Type,
    ,

----

    Matricule,
    ,

----

    Soc,
    ,

----

    Profil,
    ,

----

    Version,
    ,

----

    Repertoire,
    ,

----

Interventions :,

----

    Typeint,
    ,

----

    Date,
    ,

----

    Numcacao,
    ,

----

    Duree,
    ,

----

    Transport,
    ,

----

    Montant des Frais,
    ,

----

    Nom Intervenant,
    ,

----

    Nom laboratoire,
   

<tr>
    <td colspan="2">
</td>
</tr>

</form>

</html>

dsl de la longueur =p et merci pour ceux qui auraient la solution!

8 réponses

J_G Messages postés 1406 Date d'inscription mercredi 17 août 2005 Statut Membre Dernière intervention 28 août 2007 10
25 mai 2007 à 12:07
Salut,

Je ne regarde pas ton code HTML : trop long! illisible! (cf les liens dans ma signature).
Tu pourrais essayer de faire des petits tests avant de taper dans le lourd. Nous on a besoin que des exemples tests...

Mais bref, de ce que je comprends, essayes ça :

$fp= fopen ("Nouveau Document texte.txt","a+");
foreach($HTTP_POST_VARS as $key => $value)
fwrite($fp,$key.' : '.$value ."\r\n");
fclose($fp);

A+
<hr size ="2" width="100%" />Si vous lisez attentivement : How To Ask Questions The Smart Way
Je promets de faire attention au chapitre : How To Answer Questions in a Helpful Way
3
J_G Messages postés 1406 Date d'inscription mercredi 17 août 2005 Statut Membre Dernière intervention 28 août 2007 10
25 mai 2007 à 13:39
Ben, forcément... il faut lire la doc
Table 91. 
A list of possible modes for fopen()
using <tt>mode</tt>

<colgroup><col /><col /></colgroup>----
<tt>mode</tt> |Description |----
<var>'r'</var>, Open for reading only; place the file pointer at the
beginning of the file., ----
<var>'r+'</var>, Open for reading and writing; place the file pointer at
the beginning of the file., ----
<var>'w'</var>, Open for writing only; place the file pointer at the
beginning of the file and truncate the file to zero length.
If the file does not exist, attempt to create it., ----
<var>'w+'</var>, Open for reading and writing; place the file pointer at
the beginning of the file and truncate the file to zero
length. If the file does not exist, attempt to create it., ----
<var>'a'</var>, Open for writing only; place the file pointer at the end of
the file. If the file does not exist, attempt to create it., ----
<var>'a+'</var>, Open for reading and writing; place the file pointer at
the end of the file. If the file does not exist, attempt to
create it., ----
<var>'x'</var>, Create and open for writing only; place the file pointer at the
beginning of the file. If the file already exists, the
fopen() call will fail by returning <tt>FALSE</tt> and
generating an error of level <tt>E_WARNING</tt>. If
the file does not exist, attempt to create it. This is equivalent
to specifying <var>O_EXCL|O_CREAT</var> flags for the
underlying <var>open(2)</var> system call. This option is
supported in PHP 4.3.2 and later, and only works for local files., ----
<var>'x+'</var>, Create and open for reading and writing; place the file pointer at
the beginning of the file. If the file already exists, the
fopen() call will fail by returning <tt>FALSE</tt> and
generating an error of level <tt>E_WARNING</tt>. If
the file does not exist, attempt to create it. This is equivalent
to specifying <var>O_EXCL|O_CREAT</var> flags for the
underlying <var>open(2)</var> system call. This option is
supported in PHP 4.3.2 and later, and only works for local files.

Salut,

A+
<hr size="2" width="100%" />Si vous lisez attentivement : How To Ask Questions The Sma
3
cs_isecso Messages postés 33 Date d'inscription jeudi 17 août 2006 Statut Membre Dernière intervention 1 juin 2007
25 mai 2007 à 11:57
Salut,
"Aide please " ce n'ai pas une sujet pour le chercher mais cet une segestion et cette question existe dans le www.phpcs.com cours .

< body>
0
cs_isecso Messages postés 33 Date d'inscription jeudi 17 août 2006 Statut Membre Dernière intervention 1 juin 2007
25 mai 2007 à 11:59
Salut,
"Aide please " ce n'ai pas une sujet pour le chercher mais cet une segestion et cette question existe dans  www.phpcs.com cours .

< body>
0

Vous n’avez pas trouvé la réponse que vous recherchez ?

Posez votre question
cs_vinz78 Messages postés 207 Date d'inscription jeudi 24 mai 2007 Statut Membre Dernière intervention 24 juillet 2007
25 mai 2007 à 12:00
si je demande c'est que j'ai deja bien chercher et rien trouver a moins que tu n'ai un lien direct vers ce que je demande ?
0
cs_vinz78 Messages postés 207 Date d'inscription jeudi 24 mai 2007 Statut Membre Dernière intervention 24 juillet 2007
25 mai 2007 à 12:10
merci beaucoup sa marche !
bonne journée
0
cs_vinz78 Messages postés 207 Date d'inscription jeudi 24 mai 2007 Statut Membre Dernière intervention 24 juillet 2007
25 mai 2007 à 13:31
hum par contre petit problème sa me donne sa
-Client       
nom :
adresse :
telephone :
              
-Matériel     
Marque :
Modele :
CPU :
Ram :
OS :
IE :
Connexion :
Utilisateur :
              
-Baseteams    
Type :
Matricule :
Soc :
Profil :
Version :
Repertoire :
              
-Interventions
Typeint :
Date :
Numcacao :
Duree :
Transport :
Montantfrais :
Intervenant :
Nomlab :

-Client       
nom :  champ
adresse : champ
telephone : champ
              
-Matériel     
Marque : champ
Modele : champ
CPU : champ
Ram : champ
OS : champ
IE : champ
Connexion :champ
Utilisateur : champ
              
-Baseteams    
Type : champ
Matricule : champ
Soc : champ
Profil : champ
Version : champ
Repertoire : champ
              
-Interventions
Typeint : champ
Date : champ
Numcacao : champ
Duree : champ
Transport : champ
Montantfrais :  champ
Intervenant : champ
Nomlab : champ

il réécrit ce qu'il y a avant les champs or je souhaite qu'il mette les champ après ce qu'il y a deja écrit
0
cs_vinz78 Messages postés 207 Date d'inscription jeudi 24 mai 2007 Statut Membre Dernière intervention 24 juillet 2007
25 mai 2007 à 13:45
lol désolé j'avais totalement oublié ce détails ^^
merci bonne journée
0
Rejoignez-nous