Bonsoir à tous

Je monte actuellement un site pour mon forum. J'ai en fait un générateur de présentation de personnage (le forum étant un JDR) qui fonctionne bien. Néanmoins, j'aurai besoin d'y ajouter une nouvelle fonction. Sans entrer dans les détails, la voici:

Le système est donc basé sur le remplissage d'un formulaire par l'utilisateur, qui au final lui envoie un texte préformaté (avec les codes de mise en page de phpBB, car au départ je l'ai adapté pour phpBB) que l'utilisateur n'a qu'à copier coller. Voici le screen:
http://img28.imageshack.us/img28/1433/genscreen.png

Ce que je voudrai, c'est incorporer dans le formulaire un tableau où l'utilisateur rentre des valeurs chiffrées et la dernière ligne lui donne la somme des chiffres de la colonne. J'ai réussi à faire ce tableau avec ce code:

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
...
<head>
...
<script type="text/javascript">
	function computeResult() {
		var resultfor = document.getElementById('resultfor');
 
		var value1 = document.getElementById('for1').value;
		var value2 = document.getElementById('for2').value;
		var value3 = document.getElementById('for3').value;
 
		if (testInt(value1) && testInt(value2) && testInt(value3)) {
			resultfor.value = parseInt(value1) + parseInt(value2) + parseInt(value3);
		}
		else {
			alert('Une valeur a mal été enregistrée ou il manque une valeur');
		}
	}
 
	function testInt(value) {
		return value == parseInt(value);
	}
	</script>
 
</head>
 
<body>
<br />
<table width="216" border="1">
  <tr>
    <th width="156" scope="col"></th>
    <th width="50" scope="col">FOR</th>
  </tr>
  <tr>
    <th scope="row">Profil de base</th>
    <td align="center"><input type="text" id="for1" onChange="computeResult();" value="0" size="2" maxlength="2"></input></td>
  </tr>
  <tr>
    <th scope="row">Vos 5 PC</th>
    <td align="center"><input type="text" id="for2" onChange="computeResult();" value="0" size="2" maxlength="2"></input></td>
  </tr>
  <tr>
    <th scope="row">Bonus/malus de classe</th>
    <td align="center"><input type="text" id="for3" onChange="computeResult();" value="0" size="2" maxlength="2"></input></td>
  </tr>
   <tr>
    <th scope="row">Profil final</th>
    <td align="center"><input type="text" id="resultfor" value="0" size="2" maxlength="2"></input></td>
  </tr>
</table>
 
</body>
</html>
Ce qui donne:
http://img502.imageshack.us/img502/6076/essaiprofil.png

J'aimerai que la valeur de la dernière ligne (la somme donc, resultfor) puisse être récupérée dans le code généré par le formulaire.

Ci dessous, le formulaire:

Composé de 3 fichiers:
1)presentation.php, la page de départ
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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" media="screen" type="text/css" title="Design" href="wowcreaperso.css" />
<title>Générateur de personnage</title>
</head>
 
<body class="body">
<?php
require("presentation_generator.php");
form_meta("presentationfinale.php");
?>
 
</body>
</html>
2)presentation_generator, le formulaire proprement dit
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
<?php
function form_meta($wow){

echo'
<div align="center">
<br /><br /><br />

<table width="700" border="0" cellspacing="0" cellpadding="0" class="table">
  <tr>
    <td ><div align="center" >
      <form id="form1" name="form1" method="post" action="'.$wow.'">
        <table width="100%" border="0" cellspacing="0" cellpadding="2" >
		  <p>Veuillez remplir ce formulaire pour g&eacute;n&eacute;rer votre fiche personnage simplement.</p>
          <tr>
            <td valign="top" align="right" >Nom & Prénom du personnage: </td>
            <td valign="top"><input name="nomperso" type="text" id="nomperso" size="25" maxlength="255" /></td>
          </tr>
          <tr>
            <td valign="top" align="right" >Âge du personnage: </td>
            <td valign="top"><input name="age" type="text" id="age" size="5" maxlength="255"> ans</td>
          </tr>
          <tr>
           <td valign="top" align="right" >Faction (Alliance, Horde, Croisade d\'Argent, Le Fléau, Défias etc.) Proposez, et nous vous dirons si la faction est jouable ou non. </td>
            <td valign="top"><input name="faction" type="text" id="faction" size="15" maxlength="255"></td>
          </tr>
		  <tr>
            <td valign="top" align="right" >Race : <br /></td>
            <td valign="top"><input name="race" type="text" id="race" /></td>
          </tr> 
          <tr>
            <td valign="top" align="right" >Carri&egrave;re : <br /></td>
            <td valign="top"><input name="carriere" type="text" id="carriere" /></td>
          </tr>    
          <tr>
            <td valign="top" align="right" >Lieu de départ: <br /></td>
            <td valign="top"><input name="depart" type="text" id="depart"></td>
          </tr>          
          <tr>
            <td valign="top" align="right" >Description physique du personnage (minimum 10 lignes complètes)<br /></td>
            <td valign="top"><textarea name="physique" cols="50" rows="4" id="physique"></textarea></td>
          </tr>
		   <tr>
            <td valign="top" align="right" >Description psychologique du personnage (minimum 10 lignes complètes)<br /></td>
            <td valign="top"><textarea name="psycho" cols="50" rows="4" id="psycho"></textarea></td>
          </tr>
		   <tr>
            <td valign="top" align="right" >Histoire du personnage (avant qu\'il ne commence l\'aventure ici) (minimum 15 lignes complètes)<br /></td>
            <td valign="top"><textarea name="histoire" cols="50" rows="4" id="histoire"></textarea></td>
          </tr>
		  <tr>
            <td valign="top" align="right" >Dotations et compétence de départ (<a href="http://www.wow-jdr.kalikoba.com/creer-votre-personnage-t6.html" target=_blank>lire les règles à ce propos</a>):<br /></td>
            <td valign="top"><textarea name="dot" cols="50" rows="2" id="dot"></textarea></td>
          </tr>
		  <tr>
            <td valign="top" align="right" >Autres (traits particuliers, notes, etc):<br /></td>
            <td valign="top"><textarea name="autre" cols="50" rows="2" id="autre"></textarea></td>
          </tr>
            <td colspan="2" valign="top"><br /><div align="center">
              <input type="submit" name="Submit" value="G&eacute;n&eacute;rer la présentation" />
            </div></td>
            </tr>
        </table>
        </form>
      </div></td>
  </tr>
   
</table></div>
';
}


function generation(){
$nomperso = $_POST['nomperso'];
$age = $_POST['age'];
$faction = $_POST['faction'];
$race = $_POST['race'];
$carriere = $_POST['carriere'];
$depart = $_POST['depart'];
$physique = $_POST['physique'];
$psycho = $_POST['psycho'];
$histoire = $_POST['histoire'];
$dot = $_POST['dot'];
$autre = $_POST['autre'];

if(empty($nomperso))
{
echo '
<div align="center">
<br /><br />

  <p class="cont"><font color=white>Voici le code &agrave; ins&eacute;rer dans la section cr&eacute;ation de personnage du forum, par copier-coller. Si une correction est nécessaire, n\'hésitez pas à venir en arrière.</font></p>
  <p>
<textarea cols="70" rows="25">Informations sur le personnage :
';
} 
else
{
echo '
<div align="center">
<br /><br />


  <p class="cont"><font color=white>Voici le code &agrave; ins&eacute;rer dans la section cr&eacute;ation de personnage du forum, par copier-coller. Si une correction est nécessaire, n\'hésitez pas à venir en arrière.</font></p>
  <p>
<textarea cols="70" rows="25">Informations sur le personnage :
Nom & Prénom du personnage : '.stripslashes($nomperso).'
';
} 

if(empty($age))
{} 
else
{
echo 'Âge du personnage : '.stripslashes($age).' ans
';
} 

if(empty($faction))
{} 
else
{
echo'Faction : '.stripslashes($faction).'
';
} 

if(empty($race))
{} 
else
{
echo'Race du personnage : '.stripslashes($race).'
';
} 

if(empty($carriere))
{} 
else
{
echo'Carri&egrave;re du personnage : '.stripslashes($carriere).'
';
} 

if(empty($depart))
{} 
else
{
echo'Zone de d&ecute;part du personnage : '.stripslashes($depart).'
';
} 

if(empty($physique))
{
echo '

Background du personnage :
';
} 
else
{
echo'

Background du personnage :
';
} 

if(empty($physique))
{} 
else
{
echo'Description physique : '.stripslashes($physique).'
';
} 

if(empty($psycho))
{} 
else
{
echo'Description psychologique : '.stripslashes($psycho).'
';
} 

if(empty($histoire))
{} 
else
{
echo'Histoire : '.stripslashes($histoire).'
';
} 

if(empty($dot))
{} 
else
{
echo'Dotations et compétence de départ : '.stripslashes($dot).'
';
} 

if(empty($autre))
{} 
else
{
echo'Informations complémentaires : '.stripslashes($autre).'
';
} 

echo'

</textarea>
<br />
<a href="http://localhost"><font color=white>Retour au forum</font></a>
</p>
<br /><br />
</div>
<br />
</body>
</html>
';
}

        
?>
3)presentationfinal.php, qui montre le code généré à copier coller
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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" media="screen" type="text/css" title="Design" href="wowcreaperso.css" />
<title>Générateur de personnage</title>
</head>
 
<body class="body">
<?php
require("presentation_generator.php");
generation();
?>
</body>
</html>
Est-ce possible ? Si oui, comment faire ? Si non, une alternative vous vient-elle à l'esprit ?

Merci d'avance et joyeuse Pâques