Completer formulaire xml via formulaire php avec image

Résolu
Tzmagnum Messages postés 126 Date d'inscription   Statut Membre Dernière intervention   -  
jordane45 Messages postés 38486 Date d'inscription   Statut Modérateur Dernière intervention   -
Bonjour à tous,

Voilà je vous explique mon problème, j'ai créer un formulaire qui génère un xml.

Tout marche superbement appart quand j'essaye d'inclure des images représentant deux checkbox l'une cochée (=$on) ou l'autre non ($off) pour le permis de conduire b et c, cela rend mon fichier xml illisible comme si il était corrompu.

Je ne m'y connais pas trop, j'ai chercher sur le net et je ne trouve pas de solution qui fonctionne.

J'ai vérifier dans mon xml brut les variables @PERMIS_B@ et @PERMIS_C@ sont parfaitement reconnues.

Pourriez-vous m'aider svp ?

Je travaille sous Ubuntu avec un serveur apache2.

Merci d'avance.

Voici le code :

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
<?php
error_reporting(E_ALL); 
session_start();
header('Content-type: text/html; charset=utf-8');
include('includes/fonctions.php');
connexionbdd();

global $current_user;
      get_currentuserinfo();

$type=$_POST['type'];
$dateAide=$_POST['dateAide'];

$nom=$_POST['nom'];
$prenom=$_POST['prenom'];

$nomcomplet=$nom.' '.$prenom;
$nreg=$_POST['nreg'];
$rue=$_POST['rue'];
$num=$_POST['num'];
$boite=$_POST['boite'];
$cp=$_POST['cp'];
$commune=$_POST['commune'];
$tel=$_POST['tel'];
$mail=$_POST['mail'];
$datej=$_POST['datej'];
$dateNaissance=$_POST['dateNaissance'];
$lieuNaissance=$_POST['lieuNaissance'];
$permis=$_POST['permis'];
$on = '<img src="images/permis_on.jpg" />';
$off = '<img src="images/permis_off.jpg" />';

if ($permis = 'B')
{
 $permis_b = $on;
 $permis_c = $off;
}
elseif ($permis = 'C')
{
 $permis_b = $off;
 $permis_c = $on;
}
//Nom du futur fichier.
    $nom_fichier1 = 'permis/'.$nomcomplet.' - annexe_permis.doc';


 
 $myContent_permis = file_get_contents("template_permis.doc");
 $newFile1 = fopen("$nom_fichier1", "w");
    $myContent_permis = str_replace("@NOMCOMPLET@",$nomcomplet,$myContent_permis);
 $myContent_permis = str_replace("@NREG@",$nreg,$myContent_permis);
 $myContent_permis = str_replace("@ADR",$adr,$myContent_permis);
 $myContent_permis = str_replace("@CP",$cp,$myContent_permis);
 $myContent_permis = str_replace("@TEL@",$tel,$myContent_permis);
 $myContent_permis = str_replace("@MAIL@",$mail,$myContent_permis);
 $myContent_permis = str_replace("@DATEJ@",$datej,$myContent_permis);
 $myContent_permis = str_replace("@PERMIS_B@",$permis_b,$myContent_permis);
 $myContent_permis = str_replace("@PERMIS_C@",$permis_c,$myContent_permis);
    fwrite($newFile1,$myContent_permis);
    fclose($newFile1);

?>
<center>
L'annexe au permis a bein été créer
</center>
<br><br>


A voir également:

1 réponse

jordane45 Messages postés 38486 Date d'inscription   Statut Modérateur Dernière intervention   4 752
 
Bonjour,

Il me semble que tu dois encoder tes images en 64 bits

Ensuite, vu que tu écris dans un document .doc (word) tu peux regarder ceci
http://www.tkachenko.com/blog/archives/000106.html


0