IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

PHP & Base de données Discussion :

telecharger une vcard depuis un formulaire [MySQL]


Sujet :

PHP & Base de données

  1. #1
    Membre averti
    Profil pro
    Inscrit en
    Septembre 2009
    Messages
    16
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2009
    Messages : 16
    Par défaut telecharger une vcard depuis un formulaire
    Bonjour à tous,
    Voila je vous expose mon probleme.
    J'ai développé et récupéré du code afin de récuperer une vcard depuis des données stockées sur ma bdd. Jusqu'ici je pense que tout va bien.
    Mon problème reside dans le fait que ma vcard n'est pas générée.
    Je m'explique, je clique sur le nom que je désire, donc le formulaire va chercher les données de la personne selectionnée dans ma bdd et devrais me le sortir en .vcf
    Cependant voila ce qu'il m'arrive.
    http://img689.imageshack.us/img689/1456/capturerng.jpg
    On peut voir que les données sont bien récupérées mais il semblerait y avoir un problème de header .. :/
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
     
    <?php
    $mon_champ = isset($_POST['mon_champ']) ? $_POST['mon_champ'] : '';
     // Configuration de la connexion à la base de données
    define('MYSQL_HOTE', 'localhost');
    define('MYSQL_UTILISATEUR', 'identifiant');
    define('MYSQL_MOT_DE_PASSE', 'mdp');
    define('MYSQL_BASE_DE_DONNEES', 'bdd');
     
    // Connexion à la base de donnée
    mysql_connect(MYSQL_HOTE, MYSQL_UTILISATEUR, MYSQL_MOT_DE_PASSE) or die('<h1>Connexion au serveur impossible !</h1>');
    mysql_select_db(MYSQL_BASE_DE_DONNEES) or die('<h1>Connexion impossible à la base</h1>');
     
    	// Début du script
    $query = mysql_query("SELECT * FROM jos_contact_details;") or die (mysql_error());
    if ($query) {
        echo '<form method="post">';
    	while ($array = mysql_fetch_assoc($query)) 
    	{
    	if ($mon_champ == $array["id"]) {
                echo '<input type="radio" name="mon_champ" value="'.$array['id'] . '" checked/>' . $array['prenom']. '<br>';
            } else {
                echo '<input type="radio" name="mon_champ" value="'.$array['id'] . '">' . $array['prenom']. '<br>';
            }
    	}
     
       echo'<input type="submit" value="OK"/>';
    	echo '</form>';
    			}
    // Affichage du name choisi
    if ($mon_champ) {
        $query = mysql_query("SELECT name, prenom, email_to, con_position, name_company, address, state, telephone, mobile, fax, infos, webpage FROM jos_contact_details where id='$mon_champ';") or die (mysql_error());
    	while($donnees = mysql_fetch_array($query))
    			{
        echo 'Vous avez choisi le prenom : ' . $donnees['prenom'];
     
    $mobile = $donnees['mobile'];
    $telephone = $donnees['telephone'];
    $nom = $donnees['nom'];
    $prenom = $donnees['prenom'];
    $name_company = $donnees['name_company'];
    $con_position = $donnees['con_position'];
    $adresse = $donnees['address'];
    $region = $donnees['state'];
    $courriel = $donnees['email_to'];
    $fax = $donnees['fax'];
    $note = $donnees['infos'];
    $url = $donnees['webpage'];
     
     
    /*
    Modify the path according to your system.
    */
    require_once('class_vcard.php');
     
    /*
    Instantiate a new vcard object.
    */
    $vc = new vcard();
     
    /*
    filename is the name of the .vcf file that will be sent to the user if you
    call the download() method. If you leave this blank, the class will 
    automatically build a filename using the contact's data.
    */
    #$vc->filename = "";
     
    /*
    If you leave this blank, the current timestamp will be used.
    */
    #$vc->revision_date = "";
     
    /*
    Possible values are PUBLIC, PRIVATE, and CONFIDENTIAL. If you leave class
    blank, it will default to PUBLIC.
    */
    #$vc->class = "PUBLIC";
     
    /*
    Contact's name data.
    If you leave display_name blank, it will be built using the first and last name.
    */
    $vc->data['display_name'] = $name.' '.$prenom;
    $vc->data['first_name'] = $prenom;
    $vc->data['last_name'] = $name;
    #$vc->data['additional_name'] = ""; //Middle name
    #$vc->data['name_prefix'] = "";  //Mr. Mrs. Dr.
    #$vc->data['name_suffix'] = ""; //DDS, MD, III, other designations.
    #$vc->data['nickname'] = "";
     
    /*
    Contact's company, department, title, profession
    */
    $vc->data['company'] = $name_company;
    #$vc->data['department'] = "";
    $vc->data['title'] = $con_position;
    #$vc->data['role'] = "";
     
    /*
    Contact's work address
    */
    #$vc->data['work_po_box'] = "";
    #$vc->data['work_extended_address'] = "";
    $vc->data['work_address'] = $adresse;
    #$vc->data['work_city'] = "";
    $vc->data['work_state'] = $region;
    #$vc->data['work_postal_code'] = "";
    $vc->data['work_country'] = "FRANCE";
     
    /*
    Contact's home address
    */
    #$vc->data['home_po_box'] = "";
    #$vc->data['home_extended_address'] = "";
    #$vc->data['home_address'] = "";
    #$vc->data['home_city'] = "";
    #$vc->data['home_state'] = "";
    #$vc->data['home_postal_code'] = "";
    #$vc->data['home_country'] = "";
     
    /*
    Contact's telephone numbers.
    */
    $vc->data['office_tel'] = $telephone;
    #$vc->data['home_tel'] = "";
    $vc->data['cell_tel'] = $mobile;
    $vc->data['fax_tel'] = $fax;
    #$vc->data['pager_tel'] = "";
     
    /*
    Contact's email addresses
    */
    $vc->data['email1'] = $courriel;
    #$vc->data['email2'] = "";
     
    /*
    Contact's website
    */
    $vc->data['url'] = $url;
     
    /*
    Some other contact data.
    */
    #$vc->data['photo'] = "";  //Enter a URL.
    #$vc->data['birthday'] = "";
    #$vc->data['timezone'] = "";
     
    /*
    If you leave this blank, the class will default to using last_name or company.
    */
    #$vc->data['sort_string'] = "";
     
    /*
    Notes about this contact.
    */
    $vc->data['note'] = $note;
     
    /*
    Generate card and send as a .vcf file to user's browser for download.
    */
     
    $vc -> download();
    }}
    ?>
    Voici le code de la page du formulaire.
    et la class_vcard qui est requise.

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
     
    <?php
    class vcard {
      var $log;
      var $data;  //array of this vcard's contact data
      var $filename; //filename for download file naming
      var $class; //PUBLIC, PRIVATE, CONFIDENTIAL
      var $revision_date;
      var $card;
     
      /*
      The class constructor. You can set some defaults here if desired.
      */
      function vcard() {
        $this->log = "New vcard() called<br />";
        $this->data = array(
          "display_name"=>null
          ,"first_name"=>null
          ,"last_name"=>null
          ,"additional_name"=>null
          ,"name_prefix"=>null
          ,"name_suffix"=>null
          ,"nickname"=>null
          ,"title"=>null
          ,"role"=>null
          ,"department"=>null
          ,"company"=>null
          ,"work_po_box"=>null
          ,"work_extended_address"=>null
          ,"work_address"=>null
          ,"work_city"=>null
          ,"work_state"=>null
          ,"work_postal_code"=>null
          ,"work_country"=>null
          ,"home_po_box"=>null
          ,"home_extended_address"=>null
          ,"home_address"=>null
          ,"home_city"=>null
          ,"home_state"=>null
          ,"home_postal_code"=>null
          ,"home_country"=>null
          ,"office_tel"=>null
          ,"home_tel"=>null
          ,"cell_tel"=>null
          ,"fax_tel"=>null
          ,"pager_tel"=>null
          ,"email1"=>null
          ,"email2"=>null
          ,"url"=>null
          ,"photo"=>null
          ,"birthday"=>null
          ,"timezone"=>null
          ,"sort_string"=>null
          ,"note"=>null
          );
        return true;
      }
     
      /*
      build() method checks all the values, builds appropriate defaults for
      missing values, generates the vcard data string.
      */  
      function build() {
        $this->log .= "vcard build() called<br />";
        /*
        For many of the values, if they are not passed in, we set defaults or
        build them based on other values.
        */
        if (!$this->class) { $this->class = "PUBLIC"; }
        if (!$this->data['display_name']) {
          $this->data['display_name'] = trim($this->data['first_name']." ".$this->data['last_name']);
        }
        if (!$this->data['sort_string']) { $this->data['sort_string'] = $this->data['last_name']; }
        if (!$this->data['sort_string']) { $this->data['sort_string'] = $this->data['company']; }
        if (!$this->data['timezone']) { $this->data['timezone'] = date("O"); }
        if (!$this->revision_date) { $this->revision_date = date('Y-m-d H:i:s'); }
     
      	$this->card = "BEGIN:VCARD\r\n";
        $this->card .= "VERSION:3.0\r\n";
        $this->card .= "CLASS:".$this->class."\r\n";
        $this->card .= "PRODID:-//class_vcard from TroyWolf.com//NONSGML Version 1//EN\r\n";
        $this->card .= "REV:".$this->revision_date."\r\n";
      	$this->card .= "FN:".$this->data['display_name']."\r\n";
        $this->card .= "N:"
          .$this->data['last_name'].";"
          .$this->data['first_name'].";"
          .$this->data['additional_name'].";"
          .$this->data['name_prefix'].";"
          .$this->data['name_suffix']."\r\n";
        if ($this->data['nickname']) { $this->card .= "NICKNAME:".$this->data['nickname']."\r\n"; }
      	if ($this->data['title']) { $this->card .= "TITLE:".$this->data['title']."\r\n"; }
      	if ($this->data['company']) { $this->card .= "ORG:".$this->data['company']; }
      	if ($this->data['department']) { $this->card .= ";".$this->data['department']; }
      	$this->card .= "\r\n";
     
      	if ($this->data['work_po_box']
        || $this->data['work_extended_address']
        || $this->data['work_address']
        || $this->data['work_city']
        || $this->data['work_state']
        || $this->data['work_postal_code']
        || $this->data['work_country']) {
          $this->card .= "ADR;TYPE=work:"
            .$this->data['work_po_box'].";"
            .$this->data['work_extended_address'].";"
            .$this->data['work_address'].";"
            .$this->data['work_city'].";"
            .$this->data['work_state'].";"
            .$this->data['work_postal_code'].";"
            .$this->data['work_country']."\r\n";
        }
      	if ($this->data['home_po_box']
        || $this->data['home_extended_address']
        || $this->data['home_address']
        || $this->data['home_city']
        || $this->data['home_state']
        || $this->data['home_postal_code']
        || $this->data['home_country']) {
          $this->card .= "ADR;TYPE=home:"
            .$this->data['home_po_box'].";"
            .$this->data['home_extended_address'].";"
            .$this->data['home_address'].";"
            .$this->data['home_city'].";"
            .$this->data['home_state'].";"
            .$this->data['home_postal_code'].";"
            .$this->data['home_country']."\r\n";
        }
        if ($this->data['email1']) { $this->card .= "EMAIL;TYPE=internet,pref:".$this->data['email1']."\r\n"; }
        if ($this->data['email2']) { $this->card .= "EMAIL;TYPE=internet:".$this->data['email2']."\r\n"; }
        if ($this->data['office_tel']) { $this->card .= "TEL;TYPE=work,voice:".$this->data['office_tel']."\r\n"; }
        if ($this->data['home_tel']) { $this->card .= "TEL;TYPE=home,voice:".$this->data['home_tel']."\r\n"; }
        if ($this->data['cell_tel']) { $this->card .= "TEL;TYPE=cell,voice:".$this->data['cell_tel']."\r\n"; }
        if ($this->data['fax_tel']) { $this->card .= "TEL;TYPE=work,fax:".$this->data['fax_tel']."\r\n"; }
        if ($this->data['pager_tel']) { $this->card .= "TEL;TYPE=work,pager:".$this->data['pager_tel']."\r\n"; }
        if ($this->data['url']) { $this->card .= "URL;TYPE=work:".$this->data['url']."\r\n"; }
      	if ($this->data['birthday']) { $this->card .= "BDAY:".$this->data['birthday']."\r\n"; }
      	if ($this->data['role']) { $this->card .= "ROLE:".$this->data['role']."\r\n"; }
      	if ($this->data['note']) { $this->card .= "NOTE:".$this->data['note']."\r\n"; }
      	$this->card .= "TZ:".$this->data['timezone']."\r\n";
        $this->card .= "END:VCARD\r\n";
      }
     
      /*
      download() method streams the vcard to the browser client.
      */
      function download() {
        $this->log .= "vcard download() called<br />";
        if (!$this->card) { $this->build(); }
        if (!$this->filename) { $this->filename = trim($this->data['display_name']); }
        $this->filename = str_replace(" ", "_", $this->filename);
      	header("Content-type: text/directory");
      	header("Content-Disposition: attachment; filename=".$this->filename.".vcf");
      	header("Pragma: public");
      	echo $this->card;
        return true;
    			}
    }
    Sauriez vous où se trouve mon problème.
    je vous en remercie d'avance

    GzG

  2. #2
    Modérateur
    Avatar de sabotage
    Homme Profil pro
    Inscrit en
    Juillet 2005
    Messages
    29 208
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations forums :
    Inscription : Juillet 2005
    Messages : 29 208
    Par défaut
    Tu ne peux pas avoir un header() après un echo.
    Il te faut deux pages : une pour afficher, une pour générer la carte.
    N'oubliez pas de consulter les FAQ PHP et les cours et tutoriels PHP

  3. #3
    Membre averti
    Profil pro
    Inscrit en
    Septembre 2009
    Messages
    16
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2009
    Messages : 16
    Par défaut
    merci de ta réponse.
    en théorie ce devrait etre le cas.
    la premiere partie de code c'est l'affichage et l'autre c'est pour générer la vcard. :s

  4. #4
    Modérateur
    Avatar de sabotage
    Homme Profil pro
    Inscrit en
    Juillet 2005
    Messages
    29 208
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations forums :
    Inscription : Juillet 2005
    Messages : 29 208
    Par défaut
    Tu vois sur ta copie d'écran que ce n'est pas le cas.
    Si tu regardes ton code tu as $vc -> download(); et un peu plus haut tu as un echo.
    N'oubliez pas de consulter les FAQ PHP et les cours et tutoriels PHP

  5. #5
    Membre averti
    Profil pro
    Inscrit en
    Septembre 2009
    Messages
    16
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2009
    Messages : 16
    Par défaut
    ok.
    J'ai modifié.
    Maintenant la vcard se génére cependant mes infos ne figurent plus dedans.
    Elle se génère vide en fait.
    Aurais tu une solutions pour récuperer mes infos de la page précédente générés par ma requete.
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    if ($mon_champ) {
        $query = mysql_query("SELECT name, prenom, email_to, con_position, name_company, address, state, telephone, mobile, fax, infos, webpage FROM jos_contact_details where id='$mon_champ';") or die (mysql_error());
    	while($donnees = mysql_fetch_array($query))

  6. #6
    Modérateur
    Avatar de sabotage
    Homme Profil pro
    Inscrit en
    Juillet 2005
    Messages
    29 208
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations forums :
    Inscription : Juillet 2005
    Messages : 29 208
    Par défaut
    mes infos ne figurent plus dedans.
    Ca a marché a un moment ?
    N'oubliez pas de consulter les FAQ PHP et les cours et tutoriels PHP

  7. #7
    Membre averti
    Profil pro
    Inscrit en
    Septembre 2009
    Messages
    16
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2009
    Messages : 16
    Par défaut
    oui ca a "fonctionné". c'est à dire que ca récoltait bien les infos comme on peut voir dans les dernieres lignes de la capture d'ecran un peu plus haut .
    l'adresse, le nom, prenom, courriel ..

  8. #8
    Modérateur
    Avatar de sabotage
    Homme Profil pro
    Inscrit en
    Juillet 2005
    Messages
    29 208
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations forums :
    Inscription : Juillet 2005
    Messages : 29 208
    Par défaut
    Si tu enleves les 3 lignes header() tu obtiens quoi ?
    N'oubliez pas de consulter les FAQ PHP et les cours et tutoriels PHP

  9. #9
    Membre averti
    Profil pro
    Inscrit en
    Septembre 2009
    Messages
    16
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2009
    Messages : 16
    Par défaut
    cela me donne :
    BEGIN:VCARD VERSION:3.0 CLASSUBLIC PRODID:-//class_vcard //NONSGML Version 1//EN REV:2010-03-24 00:24:31 FN: N:;;;; ADR;TYPE=work:;;;;;;FRANCE TZ:+0100 END:VCARD

  10. #10
    Modérateur
    Avatar de sabotage
    Homme Profil pro
    Inscrit en
    Juillet 2005
    Messages
    29 208
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations forums :
    Inscription : Juillet 2005
    Messages : 29 208
    Par défaut
    Tu as du retirer un peu plus que les echo.
    N'oubliez pas de consulter les FAQ PHP et les cours et tutoriels PHP

  11. #11
    Membre averti
    Profil pro
    Inscrit en
    Septembre 2009
    Messages
    16
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2009
    Messages : 16
    Par défaut
    voici les deux pages de code:
    page d'affichage :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
     
    <?php
    $mon_champ = isset($_POST['mon_champ']) ? $_POST['mon_champ'] : '';
     // Configuration de la connexion à la base de données
    define('MYSQL_HOTE', 'localhost');
    define('MYSQL_UTILISATEUR', 'user');
    define('MYSQL_MOT_DE_PASSE', 'mdp');
    define('MYSQL_BASE_DE_DONNEES', 'bdd');
     
    // Connexion à la base de donnée
    mysql_connect(MYSQL_HOTE, MYSQL_UTILISATEUR, MYSQL_MOT_DE_PASSE) or die('<h1>Connexion au serveur impossible !</h1>');
    mysql_select_db(MYSQL_BASE_DE_DONNEES) or die('<h1>Connexion impossible à la base</h1>');
     
    	// Début du script
    $query = mysql_query("SELECT * FROM jos_contact_details;") or die (mysql_error());
    if ($query) {
        echo '<form method="post" action="class_vcard.php">';
    	while ($array = mysql_fetch_assoc($query)) 
    	{
    	if ($mon_champ == $array["id"]) {
                echo '<input type="radio" name="mon_champ" value="'.$array['id'] . '" checked/>' . $array['prenom']. '<br>';
            } else {
                echo '<input type="radio" name="mon_champ" value="'.$array['id'] . '">' . $array['prenom']. '<br>';
            }
    	}
     
       echo'<input type="submit" value="OK"/>';
    	echo '</form>';
    			}
    // Affichage du name choisi
    if ($mon_champ) {
        $query = mysql_query("SELECT name, prenom, email_to, con_position, name_company, address, state, telephone, mobile, fax, infos, webpage FROM jos_contact_details where id='$mon_champ';") or die (mysql_error());
    	while($donnees = mysql_fetch_array($query))
    			{
        #echo 'Vous avez choisi le prenom : ' . $donnees['prenom'];
     
    }}
    ?>
    Page d'appel de la vcard (class vcard) :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
     
    <?php
     
    $mobile = $donnees['mobile'];
    $telephone = $donnees['telephone'];
    $nom = $donnees['nom'];
    $prenom = $donnees['prenom'];
    $name_company = $donnees['name_company'];
    $con_position = $donnees['con_position'];
    $adresse = $donnees['address'];
    $region = $donnees['state'];
    $courriel = $donnees['email_to'];
    $fax = $donnees['fax'];
    $note = $donnees['infos'];
    $url = $donnees['webpage'];
     
     
    /*
    Modify the path according to your system.
    */
    require_once('class_vcard.php');
     
    /*
    Instantiate a new vcard object.
    */
    $vc = new vcard();
     
    /*
    filename is the name of the .vcf file that will be sent to the user if you
    call the download() method. If you leave this blank, the class will 
    automatically build a filename using the contact's data.
    */
    #$vc->filename = "";
     
    /*
    If you leave this blank, the current timestamp will be used.
    */
    #$vc->revision_date = "";
     
    /*
    Possible values are PUBLIC, PRIVATE, and CONFIDENTIAL. If you leave class
    blank, it will default to PUBLIC.
    */
    #$vc->class = "PUBLIC";
     
    /*
    Contact's name data.
    If you leave display_name blank, it will be built using the first and last name.
    */
    $vc->data['display_name'] = $name.' '.$prenom;
    $vc->data['first_name'] = $prenom;
    $vc->data['last_name'] = $name;
    #$vc->data['additional_name'] = ""; //Middle name
    #$vc->data['name_prefix'] = "";  //Mr. Mrs. Dr.
    #$vc->data['name_suffix'] = ""; //DDS, MD, III, other designations.
    #$vc->data['nickname'] = "";
     
    /*
    Contact's company, department, title, profession
    */
    $vc->data['company'] = $name_company;
    #$vc->data['department'] = "";
    $vc->data['title'] = $con_position;
    #$vc->data['role'] = "";
     
    /*
    Contact's work address
    */
    #$vc->data['work_po_box'] = "";
    #$vc->data['work_extended_address'] = "";
    $vc->data['work_address'] = $adresse;
    #$vc->data['work_city'] = "";
    $vc->data['work_state'] = $region;
    #$vc->data['work_postal_code'] = "";
    $vc->data['work_country'] = "FRANCE";
     
    /*
    Contact's home address
    */
    #$vc->data['home_po_box'] = "";
    #$vc->data['home_extended_address'] = "";
    #$vc->data['home_address'] = "";
    #$vc->data['home_city'] = "";
    #$vc->data['home_state'] = "";
    #$vc->data['home_postal_code'] = "";
    #$vc->data['home_country'] = "";
     
    /*
    Contact's telephone numbers.
    */
    $vc->data['office_tel'] = $telephone;
    #$vc->data['home_tel'] = "";
    $vc->data['cell_tel'] = $mobile;
    $vc->data['fax_tel'] = $fax;
    #$vc->data['pager_tel'] = "";
     
    /*
    Contact's email addresses
    */
    $vc->data['email1'] = $courriel;
    #$vc->data['email2'] = "";
     
    /*
    Contact's website
    */
    $vc->data['url'] = $url;
     
    /*
    Some other contact data.
    */
    #$vc->data['photo'] = "";  //Enter a URL.
    #$vc->data['birthday'] = "";
    #$vc->data['timezone'] = "";
     
    /*
    If you leave this blank, the class will default to using last_name or company.
    */
    #$vc->data['sort_string'] = "";
     
    /*
    Notes about this contact.
    */
    $vc->data['note'] = $note;
     
    /*
    Generate card and send as a .vcf file to user's browser for download.
    */
     
    $vc -> download();
     
     
    /*
    * Filename.......: class_vcard.php
    * Last Modified..: 2005/07/14 13:30:00
    * Description....: A class to generate vCards for contact data.
    */
    class vcard {
      var $log;
      var $data;  //array of this vcard's contact data
      var $filename; //filename for download file naming
      var $class; //PUBLIC, PRIVATE, CONFIDENTIAL
      var $revision_date;
      var $card;
     
      /*
      The class constructor. You can set some defaults here if desired.
      */
      function vcard() {
        $this->log = "New vcard() called<br />";
        $this->data = array(
          "display_name"=>null
          ,"first_name"=>null
          ,"last_name"=>null
          ,"additional_name"=>null
          ,"name_prefix"=>null
          ,"name_suffix"=>null
          ,"nickname"=>null
          ,"title"=>null
          ,"role"=>null
          ,"department"=>null
          ,"company"=>null
          ,"work_po_box"=>null
          ,"work_extended_address"=>null
          ,"work_address"=>null
          ,"work_city"=>null
          ,"work_state"=>null
          ,"work_postal_code"=>null
          ,"work_country"=>null
          ,"home_po_box"=>null
          ,"home_extended_address"=>null
          ,"home_address"=>null
          ,"home_city"=>null
          ,"home_state"=>null
          ,"home_postal_code"=>null
          ,"home_country"=>null
          ,"office_tel"=>null
          ,"home_tel"=>null
          ,"cell_tel"=>null
          ,"fax_tel"=>null
          ,"pager_tel"=>null
          ,"email1"=>null
          ,"email2"=>null
          ,"url"=>null
          ,"photo"=>null
          ,"birthday"=>null
          ,"timezone"=>null
          ,"sort_string"=>null
          ,"note"=>null
          );
        return true;
      }
     
      /*
      build() method checks all the values, builds appropriate defaults for
      missing values, generates the vcard data string.
      */  
      function build() {
        $this->log .= "vcard build() called<br />";
        /*
        For many of the values, if they are not passed in, we set defaults or
        build them based on other values.
        */
        if (!$this->class) { $this->class = "PUBLIC"; }
        if (!$this->data['display_name']) {
          $this->data['display_name'] = trim($this->data['first_name']." ".$this->data['last_name']);
        }
        if (!$this->data['sort_string']) { $this->data['sort_string'] = $this->data['last_name']; }
        if (!$this->data['sort_string']) { $this->data['sort_string'] = $this->data['company']; }
        if (!$this->data['timezone']) { $this->data['timezone'] = date("O"); }
        if (!$this->revision_date) { $this->revision_date = date('Y-m-d H:i:s'); }
     
      	$this->card = "BEGIN:VCARD\r\n";
        $this->card .= "VERSION:3.0\r\n";
        $this->card .= "CLASS:".$this->class."\r\n";
        $this->card .= "PRODID:-//class_vcard from TroyWolf.com//NONSGML Version 1//EN\r\n";
        $this->card .= "REV:".$this->revision_date."\r\n";
      	$this->card .= "FN:".$this->data['display_name']."\r\n";
        $this->card .= "N:"
          .$this->data['last_name'].";"
          .$this->data['first_name'].";"
          .$this->data['additional_name'].";"
          .$this->data['name_prefix'].";"
          .$this->data['name_suffix']."\r\n";
        if ($this->data['nickname']) { $this->card .= "NICKNAME:".$this->data['nickname']."\r\n"; }
      	if ($this->data['title']) { $this->card .= "TITLE:".$this->data['title']."\r\n"; }
      	if ($this->data['company']) { $this->card .= "ORG:".$this->data['company']; }
      	if ($this->data['department']) { $this->card .= ";".$this->data['department']; }
      	$this->card .= "\r\n";
     
      	if ($this->data['work_po_box']
        || $this->data['work_extended_address']
        || $this->data['work_address']
        || $this->data['work_city']
        || $this->data['work_state']
        || $this->data['work_postal_code']
        || $this->data['work_country']) {
          $this->card .= "ADR;TYPE=work:"
            .$this->data['work_po_box'].";"
            .$this->data['work_extended_address'].";"
            .$this->data['work_address'].";"
            .$this->data['work_city'].";"
            .$this->data['work_state'].";"
            .$this->data['work_postal_code'].";"
            .$this->data['work_country']."\r\n";
        }
      	if ($this->data['home_po_box']
        || $this->data['home_extended_address']
        || $this->data['home_address']
        || $this->data['home_city']
        || $this->data['home_state']
        || $this->data['home_postal_code']
        || $this->data['home_country']) {
          $this->card .= "ADR;TYPE=home:"
            .$this->data['home_po_box'].";"
            .$this->data['home_extended_address'].";"
            .$this->data['home_address'].";"
            .$this->data['home_city'].";"
            .$this->data['home_state'].";"
            .$this->data['home_postal_code'].";"
            .$this->data['home_country']."\r\n";
        }
        if ($this->data['email1']) { $this->card .= "EMAIL;TYPE=internet,pref:".$this->data['email1']."\r\n"; }
        if ($this->data['email2']) { $this->card .= "EMAIL;TYPE=internet:".$this->data['email2']."\r\n"; }
        if ($this->data['office_tel']) { $this->card .= "TEL;TYPE=work,voice:".$this->data['office_tel']."\r\n"; }
        if ($this->data['home_tel']) { $this->card .= "TEL;TYPE=home,voice:".$this->data['home_tel']."\r\n"; }
        if ($this->data['cell_tel']) { $this->card .= "TEL;TYPE=cell,voice:".$this->data['cell_tel']."\r\n"; }
        if ($this->data['fax_tel']) { $this->card .= "TEL;TYPE=work,fax:".$this->data['fax_tel']."\r\n"; }
        if ($this->data['pager_tel']) { $this->card .= "TEL;TYPE=work,pager:".$this->data['pager_tel']."\r\n"; }
        if ($this->data['url']) { $this->card .= "URL;TYPE=work:".$this->data['url']."\r\n"; }
      	if ($this->data['birthday']) { $this->card .= "BDAY:".$this->data['birthday']."\r\n"; }
      	if ($this->data['role']) { $this->card .= "ROLE:".$this->data['role']."\r\n"; }
      	if ($this->data['note']) { $this->card .= "NOTE:".$this->data['note']."\r\n"; }
      	$this->card .= "TZ:".$this->data['timezone']."\r\n";
        $this->card .= "END:VCARD\r\n";
      }
     
      /*
      download() method streams the vcard to the browser client.
      */
      function download() {
        $this->log .= "vcard download() called<br />";
        if (!$this->card) { $this->build(); }
        if (!$this->filename) { $this->filename = trim($this->data['display_name']); }
        $this->filename = str_replace(" ", "_", $this->filename);
     
      	echo $this->card;
        return true;
    			}
    }

  12. #12
    Modérateur
    Avatar de sabotage
    Homme Profil pro
    Inscrit en
    Juillet 2005
    Messages
    29 208
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations forums :
    Inscription : Juillet 2005
    Messages : 29 208
    Par défaut
    Ca ne va pas du tout : tu as la requête dans un fichier et la récuperation des valeurs de $donnes dans l'autre fichier.
    N'oubliez pas de consulter les FAQ PHP et les cours et tutoriels PHP

  13. #13
    Membre averti
    Profil pro
    Inscrit en
    Septembre 2009
    Messages
    16
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2009
    Messages : 16
    Par défaut
    en fait non j'ai la récupération des données dans le premier fichier.
    et donc le second fichier j'ai retranscrit uniquement les variables.
    mais bon encore une fois ca ne peut fonctionner car rien n'envoie la valeur des variables.
    je ne sais pas quoi faire.
    il faudrait que je trouve un moyen pour récuperer mes le resultat de ma requete dans le premier et dans le deuxieme fichier :/

  14. #14
    Modérateur
    Avatar de sabotage
    Homme Profil pro
    Inscrit en
    Juillet 2005
    Messages
    29 208
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations forums :
    Inscription : Juillet 2005
    Messages : 29 208
    Par défaut
    La requête que tu as à la fin du premier fichier doit être dans le deuxième avec intval($_POST['mon_champ']) au lieu de $mon_champ.
    N'oubliez pas de consulter les FAQ PHP et les cours et tutoriels PHP

  15. #15
    Membre averti
    Profil pro
    Inscrit en
    Septembre 2009
    Messages
    16
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2009
    Messages : 16
    Par défaut
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
     
    // Affichage du name choisi
    if (intval($_POST['mon_champ'])) {
        $query = mysql_query("SELECT name, prenom, email_to, con_position, name_company, address, state, telephone, mobile, fax, infos, webpage FROM jos_contact_details where id='$mon_champ';") or die (mysql_error());
    	while($donnees = mysql_fetch_array($query)
    	{
        #echo 'Vous avez choisi le prenom : ' . $donnees['prenom'];
     
    $mobile = $donnees['mobile'];
    $telephone = $donnees['telephone'];
    $nom = $donnees['nom'];
    $prenom = $donnees['prenom'];
    $name_company = $donnees['name_company'];
    $con_position = $donnees['con_position'];
    $adresse = $donnees['address'];
    $region = $donnees['state'];
    $courriel = $donnees['email_to'];
    $fax = $donnees['fax'];
    $note = $donnees['infos'];
    $url = $donnees['webpage'];
    	}
    j'ai donc ce code la en tout début de mon second fichier.
    cependant lorsque mon second fichier s'execute aprés avoir été appelé par le premier il m'indique que l'accolade apres le while est inattendue.

    second fichier en entier :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
     
    <?php
     
    // Affichage du name choisi
    if (intval($_POST['mon_champ'])) {
        $query = mysql_query("SELECT name, prenom, email_to, con_position, name_company, address, state, telephone, mobile, fax, infos, webpage FROM jos_contact_details where id='$mon_champ';") or die (mysql_error());
    	while($donnees = mysql_fetch_array($query)
    	{
        #echo 'Vous avez choisi le prenom : ' . $donnees['prenom'];
     
    $mobile = $donnees['mobile'];
    $telephone = $donnees['telephone'];
    $nom = $donnees['nom'];
    $prenom = $donnees['prenom'];
    $name_company = $donnees['name_company'];
    $con_position = $donnees['con_position'];
    $adresse = $donnees['address'];
    $region = $donnees['state'];
    $courriel = $donnees['email_to'];
    $fax = $donnees['fax'];
    $note = $donnees['infos'];
    $url = $donnees['webpage'];
    	}
     
     
    /*
    Modify the path according to your system.
    */
    require_once('class_vcard.php');
     
    /*
    Instantiate a new vcard object.
    */
    $vc = new vcard();
     
    /*
    filename is the name of the .vcf file that will be sent to the user if you
    call the download() method. If you leave this blank, the class will 
    automatically build a filename using the contact's data.
    */
    #$vc->filename = "";
     
    /*
    If you leave this blank, the current timestamp will be used.
    */
    #$vc->revision_date = "";
     
    /*
    Possible values are PUBLIC, PRIVATE, and CONFIDENTIAL. If you leave class
    blank, it will default to PUBLIC.
    */
    #$vc->class = "PUBLIC";
     
    /*
    Contact's name data.
    If you leave display_name blank, it will be built using the first and last name.
    */
    $vc->data['display_name'] = $name.' '.$prenom;
    $vc->data['first_name'] = $prenom;
    $vc->data['last_name'] = $name;
    #$vc->data['additional_name'] = ""; //Middle name
    #$vc->data['name_prefix'] = "";  //Mr. Mrs. Dr.
    #$vc->data['name_suffix'] = ""; //DDS, MD, III, other designations.
    #$vc->data['nickname'] = "";
     
    /*
    Contact's company, department, title, profession
    */
    $vc->data['company'] = $name_company;
    #$vc->data['department'] = "";
    $vc->data['title'] = $con_position;
    #$vc->data['role'] = "";
     
    /*
    Contact's work address
    */
    #$vc->data['work_po_box'] = "";
    #$vc->data['work_extended_address'] = "";
    $vc->data['work_address'] = $adresse;
    #$vc->data['work_city'] = "";
    $vc->data['work_state'] = $region;
    #$vc->data['work_postal_code'] = "";
    $vc->data['work_country'] = "FRANCE";
     
    /*
    Contact's home address
    */
    #$vc->data['home_po_box'] = "";
    #$vc->data['home_extended_address'] = "";
    #$vc->data['home_address'] = "";
    #$vc->data['home_city'] = "";
    #$vc->data['home_state'] = "";
    #$vc->data['home_postal_code'] = "";
    #$vc->data['home_country'] = "";
     
    /*
    Contact's telephone numbers.
    */
    $vc->data['office_tel'] = $telephone;
    #$vc->data['home_tel'] = "";
    $vc->data['cell_tel'] = $mobile;
    $vc->data['fax_tel'] = $fax;
    #$vc->data['pager_tel'] = "";
     
    /*
    Contact's email addresses
    */
    $vc->data['email1'] = $courriel;
    #$vc->data['email2'] = "";
     
    /*
    Contact's website
    */
    $vc->data['url'] = $url;
     
    /*
    Some other contact data.
    */
    #$vc->data['photo'] = "";  //Enter a URL.
    #$vc->data['birthday'] = "";
    #$vc->data['timezone'] = "";
     
    /*
    If you leave this blank, the class will default to using last_name or company.
    */
    #$vc->data['sort_string'] = "";
     
    /*
    Notes about this contact.
    */
    $vc->data['note'] = $note;
     
    /*
    Generate card and send as a .vcf file to user's browser for download.
    */
     
    $vc -> download();
     
     
    /*
    * Filename.......: class_vcard.php
    * Author.........: Troy Wolf [troy@troywolf.com]
    * Last Modified..: 2005/07/14 13:30:00
    * Description....: A class to generate vCards for contact data.
    */
    class vcard {
      var $log;
      var $data;  //array of this vcard's contact data
      var $filename; //filename for download file naming
      var $class; //PUBLIC, PRIVATE, CONFIDENTIAL
      var $revision_date;
      var $card;
     
      /*
      The class constructor. You can set some defaults here if desired.
      */
      function vcard() {
        $this->log = "New vcard() called<br />";
        $this->data = array(
          "display_name"=>null
          ,"first_name"=>null
          ,"last_name"=>null
          ,"additional_name"=>null
          ,"name_prefix"=>null
          ,"name_suffix"=>null
          ,"nickname"=>null
          ,"title"=>null
          ,"role"=>null
          ,"department"=>null
          ,"company"=>null
          ,"work_po_box"=>null
          ,"work_extended_address"=>null
          ,"work_address"=>null
          ,"work_city"=>null
          ,"work_state"=>null
          ,"work_postal_code"=>null
          ,"work_country"=>null
          ,"home_po_box"=>null
          ,"home_extended_address"=>null
          ,"home_address"=>null
          ,"home_city"=>null
          ,"home_state"=>null
          ,"home_postal_code"=>null
          ,"home_country"=>null
          ,"office_tel"=>null
          ,"home_tel"=>null
          ,"cell_tel"=>null
          ,"fax_tel"=>null
          ,"pager_tel"=>null
          ,"email1"=>null
          ,"email2"=>null
          ,"url"=>null
          ,"photo"=>null
          ,"birthday"=>null
          ,"timezone"=>null
          ,"sort_string"=>null
          ,"note"=>null
          );
        return true;
      }
     
      /*
      build() method checks all the values, builds appropriate defaults for
      missing values, generates the vcard data string.
      */  
      function build() {
        $this->log .= "vcard build() called<br />";
        /*
        For many of the values, if they are not passed in, we set defaults or
        build them based on other values.
        */
        if (!$this->class) { $this->class = "PUBLIC"; }
        if (!$this->data['display_name']) {
          $this->data['display_name'] = trim($this->data['first_name']." ".$this->data['last_name']);
        }
        if (!$this->data['sort_string']) { $this->data['sort_string'] = $this->data['last_name']; }
        if (!$this->data['sort_string']) { $this->data['sort_string'] = $this->data['company']; }
        if (!$this->data['timezone']) { $this->data['timezone'] = date("O"); }
        if (!$this->revision_date) { $this->revision_date = date('Y-m-d H:i:s'); }
     
      	$this->card = "BEGIN:VCARD\r\n";
        $this->card .= "VERSION:3.0\r\n";
        $this->card .= "CLASS:".$this->class."\r\n";
        $this->card .= "PRODID:-//class_vcard from TroyWolf.com//NONSGML Version 1//EN\r\n";
        $this->card .= "REV:".$this->revision_date."\r\n";
      	$this->card .= "FN:".$this->data['display_name']."\r\n";
        $this->card .= "N:"
          .$this->data['last_name'].";"
          .$this->data['first_name'].";"
          .$this->data['additional_name'].";"
          .$this->data['name_prefix'].";"
          .$this->data['name_suffix']."\r\n";
        if ($this->data['nickname']) { $this->card .= "NICKNAME:".$this->data['nickname']."\r\n"; }
      	if ($this->data['title']) { $this->card .= "TITLE:".$this->data['title']."\r\n"; }
      	if ($this->data['company']) { $this->card .= "ORG:".$this->data['company']; }
      	if ($this->data['department']) { $this->card .= ";".$this->data['department']; }
      	$this->card .= "\r\n";
     
      	if ($this->data['work_po_box']
        || $this->data['work_extended_address']
        || $this->data['work_address']
        || $this->data['work_city']
        || $this->data['work_state']
        || $this->data['work_postal_code']
        || $this->data['work_country']) {
          $this->card .= "ADR;TYPE=work:"
            .$this->data['work_po_box'].";"
            .$this->data['work_extended_address'].";"
            .$this->data['work_address'].";"
            .$this->data['work_city'].";"
            .$this->data['work_state'].";"
            .$this->data['work_postal_code'].";"
            .$this->data['work_country']."\r\n";
        }
      	if ($this->data['home_po_box']
        || $this->data['home_extended_address']
        || $this->data['home_address']
        || $this->data['home_city']
        || $this->data['home_state']
        || $this->data['home_postal_code']
        || $this->data['home_country']) {
          $this->card .= "ADR;TYPE=home:"
            .$this->data['home_po_box'].";"
            .$this->data['home_extended_address'].";"
            .$this->data['home_address'].";"
            .$this->data['home_city'].";"
            .$this->data['home_state'].";"
            .$this->data['home_postal_code'].";"
            .$this->data['home_country']."\r\n";
        }
        if ($this->data['email1']) { $this->card .= "EMAIL;TYPE=internet,pref:".$this->data['email1']."\r\n"; }
        if ($this->data['email2']) { $this->card .= "EMAIL;TYPE=internet:".$this->data['email2']."\r\n"; }
        if ($this->data['office_tel']) { $this->card .= "TEL;TYPE=work,voice:".$this->data['office_tel']."\r\n"; }
        if ($this->data['home_tel']) { $this->card .= "TEL;TYPE=home,voice:".$this->data['home_tel']."\r\n"; }
        if ($this->data['cell_tel']) { $this->card .= "TEL;TYPE=cell,voice:".$this->data['cell_tel']."\r\n"; }
        if ($this->data['fax_tel']) { $this->card .= "TEL;TYPE=work,fax:".$this->data['fax_tel']."\r\n"; }
        if ($this->data['pager_tel']) { $this->card .= "TEL;TYPE=work,pager:".$this->data['pager_tel']."\r\n"; }
        if ($this->data['url']) { $this->card .= "URL;TYPE=work:".$this->data['url']."\r\n"; }
      	if ($this->data['birthday']) { $this->card .= "BDAY:".$this->data['birthday']."\r\n"; }
      	if ($this->data['role']) { $this->card .= "ROLE:".$this->data['role']."\r\n"; }
      	if ($this->data['note']) { $this->card .= "NOTE:".$this->data['note']."\r\n"; }
      	$this->card .= "TZ:".$this->data['timezone']."\r\n";
        $this->card .= "END:VCARD\r\n";
      }
     
      /*
      download() method streams the vcard to the browser client.
      */
      function download() {
        $this->log .= "vcard download() called<br />";
        if (!$this->card) { $this->build(); }
        if (!$this->filename) { $this->filename = trim($this->data['display_name']); }
        $this->filename = str_replace(" ", "_", $this->filename);
      	header("Content-type: text/directory");
      	header("Content-Disposition: attachment; filename=".$this->filename.".vcf");
      	header("Pragma: public");
      	echo $this->card;
        return true;
    			}
    }}

  16. #16
    Membre émérite

    Profil pro
    Inscrit en
    Juin 2004
    Messages
    772
    Détails du profil
    Informations personnelles :
    Âge : 41
    Localisation : France, Loire Atlantique (Pays de la Loire)

    Informations forums :
    Inscription : Juin 2004
    Messages : 772
    Par défaut
    Citation Envoyé par sabotage Voir le message
    La requête que tu as à la fin du premier fichier doit être dans le deuxième avec intval($_POST['mon_champ']) au lieu de $mon_champ.
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    $query = mysql_query(
        "SELECT name, prenom, email_to, con_position, name_company, 
        address, state, telephone, mobile, fax, infos, webpage 
        FROM jos_contact_details 
        where id='$mon_champ';"
    ) or die (mysql_error());

  17. #17
    Membre averti
    Profil pro
    Inscrit en
    Septembre 2009
    Messages
    16
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2009
    Messages : 16
    Par défaut
    je le ferme. excusez moi pour le dérangement.

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Réponses: 5
    Dernier message: 09/10/2008, 20h14
  2. Ouvrir une fenêtre depuis un formulaire
    Par Tellounet dans le forum Général JavaScript
    Réponses: 8
    Dernier message: 23/06/2008, 17h17
  3. Appel d'une fonction depuis sous formulaire
    Par El_Manu dans le forum VBA Access
    Réponses: 7
    Dernier message: 02/11/2007, 18h21
  4. contrôle d'une valeur depuis un formulaire
    Par zougna dans le forum IHM
    Réponses: 4
    Dernier message: 24/08/2007, 14h56
  5. Réponses: 4
    Dernier message: 24/04/2007, 17h45

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo