Précédent   Forum des professionnels en informatique > PHP > Langage > Fichiers
Fichiers Forum d'entraide sur les fichiers avec PHP. Avant de poster -> FAQ fichiers et Sources fichiers
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 09/06/2007, 13h12   #1
Invité de passage
 
Inscription : juin 2007
Messages : 3
Détails du profil
Informations forums :
Inscription : juin 2007
Messages : 3
Points : 1
Points : 1
Par défaut Comment garder la mise en forme d'un textarea ?

Bonjour tout le monde

Je suis tout nouveau sur ce site web j'espère dans le futur pouvoir contribuer

Mais aujourd'hui je suis face a un problème assez récurent, je m'explique:

Je dispose d'un formulaire codé d'une partie en PHP et d'une autre en html, j'y est intégrer plusieurs champs tels que:
Prénom/Nom
Fonction
Tel
Portable
Fax
Adresse
Code postal/ville
Evénement important
Mais je suis face a un problème avec le champ Evénement important, ah j'oublie une fois ce formulaire valider un script force le téléchargement vers le pc de la personne.
Ceci lui génère un fichier html (en gros a l'intérieur c'est une signature qui est crée)
Mais le HIC est le suivant : lorsque le champ Evénement important est compléter celui ci ne prend pas en compte les saut de ligne tout le texte tien que sur une ligne (dans le fichier html générer)
J'aurais souhaitais que mon script puisse comprendre quand une personne saute la ligne dans le champ Evénement important

Voici le fichier:

Code php :
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
<?PHP
 
if (isset($_POST['soumettre'])){   
   $nom=$_POST['nom'];
   $tel=$_POST['tel'];
   $portable=$_POST['portable'];
   $fonction=$_POST['fonction'];
   $fax=$_POST['fax'];
   $adresse=$_POST['adresse'];
   $codepostal=$_POST['codepostal'];
    $evenement=$_POST['evenement'];
 
 
   header('Content-disposition: attachment; filename=signature.htm');
 
 
   header('Content-Type: application/force-download');
   header('Content-Transfer-Encoding: fichier');
 
 
   header('Pragma: no-cache');
   header('Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0');
   header('Expires: 0');
 
 
   echo "<strong>$nom</strong><br>";
   if ($fonction!="") echo "$fonction<br>";
   if ($tel!="") echo "Tel: $tel<br>";
   if ($portable!="") echo "Port: $portable<br>";
   if ($fax!="") echo "Fax: $fax<br>";
   if ($adresse!="") echo "$adresse<br>";
   if ($codepostal!="") echo "$codepostal<br>";
   if ($evenement!="") echo "$evenement<br>";
   exit();
}
 
?>
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>signature.</title>
<style type="text/css">
<!--
.Style1 {
   font-size: 16px;
   font-weight: bold;
}
.Style2 {
   color: #FF0000;
   font-weight: bold;
}
.Style3 {font-size: 24px; font-weight: bold; }
-->
</style>
</head>
<body>
 
 
<form name='formulaire' method='post'>
  <p align="center" class="Style3">Création de votre signature</p>
  <p class="Style1">&nbsp;</p>
  <table>
    <th>&nbsp;</th>
      <br>
<tr>
  <td>Prénom/Nom</td>
  <td><input name='nom' type='text' size='50'></td></tr>
<tr>
<tr>
  <td>Fonction</td>
  <td><input name='fonction' type='text' id="fonction" size='50'></td></tr>
 
<tr>
  <td>Tel</td>
  <td><input name='tel' type='text' id="tel" size='50'></td></tr>
<tr>
  <td>Portable</td>
  <td><input name='portable' type='text' id="portable" size='50'></td></tr>
 
  <td>Fax</td>
  <td><input name='fax' type='text' id="fax" size='50'></td></tr>
 
  <td>Adresse</td>
  <td><input name='adresse' type='text' id="adresse" size='50'></td></tr>
 
  <td>Code postal/ville</td>
  <td><input name='codepostal' type='text' id="codepostal" size='50'></td></tr>
 
  <td>Evénement important</td>
  <td><textarea  WRAP="hard"  name="evenement" COLS="50" rows="5" ></textarea></td></tr>
 
  <td>&nbsp;</td>
  <td>
<input name='soumettre' type='submit' value='Valider'></td></tr>
 
</table>
 
<p>&nbsp;</p>
</form>
</body>
</html>
Merci d'avance pour votre aide
dns78 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 09/06/2007, 14h04   #2
Inactif
 
Avatar de Kerod
 
Inscription : septembre 2004
Messages : 11 753
Détails du profil
Informations forums :
Inscription : septembre 2004
Messages : 11 753
Points : 14 585
Points : 14 585
Il te faut utiliser la fonction : nl2br cf. : Comment remplacer les retours à la ligne (\n) par la balise HTML <BR/>?
Kerod est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 09/06/2007, 14h13   #3
Invité de passage
 
Inscription : juin 2007
Messages : 3
Détails du profil
Informations forums :
Inscription : juin 2007
Messages : 3
Points : 1
Points : 1
Merci à toi

Je suis un noob avec quelques mois d'expérience dans la programmation, j'ai tester l'intégration de la fonction nl2br dans mon fichier mais rien à faire.
Je sollicite de nouveau votre aide
dns78 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 09/06/2007, 14h48   #4
Inactif
 
Avatar de Kerod
 
Inscription : septembre 2004
Messages : 11 753
Détails du profil
Informations forums :
Inscription : septembre 2004
Messages : 11 753
Points : 14 585
Points : 14 585
Si ceci ne fonctionne pas :
Alors teste :
Code :
str_replace("\n", "<br />", $evenement);
Kerod est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 09/06/2007, 14h53   #5
Invité de passage
 
Inscription : juin 2007
Messages : 3
Détails du profil
Informations forums :
Inscription : juin 2007
Messages : 3
Points : 1
Points : 1
Par défaut Résolue

Ça fonctionne parfaitement grand merci à toi problème résolu
encore merci kerod
dns78 est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité Cette discussion est résolue.
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 11h42.


 
 
 
 
Partenaires

Hébergement Web