J'ai un p'tit souci.....
Afin de simuler un process, j'ai écrit ce matin une petite page de test.
Mais le problème n'est pas là...

J'y ai ajouté une classe Textarea et quand j'insère du texte dans cette zone, le texte apparait à l'endroit du dernier bouton cliqué....
Je mets ma classe en attachement.
Il n'y a rien dans le log PHP....
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
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
<!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" />
<title>Test variable Statique</title>
<style type="text/css">
<!--
body,td,th {
	font-family: Geneva, Arial, Helvetica, sans-serif;
}
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
-->
</style></head>
 
<body>
 
<!-- ============================================================================================================================ -->
<?php
require_once $_SERVER['DOCUMENT_ROOT'] . "/config/functions.php";  
require_once $_SERVER['DOCUMENT_ROOT'] . "/config/constants.php";  
//
//	Défintion de la forme....
// ------------------------------------------------------------------------------------------------------------------------------- //	
require_once $_SERVER["DOCUMENT_ROOT"] . "/class/define/equate.php" ;
// ------------------------------------------------------------------------------------------------------------------------------- //	
class Subscribe // extends Textarea
{	private $debug, $message ;
	private static  $step = 0, $start, $curr = 0, $end ;
 
	private $disenabled = array ( 	false 		=> "disabled" , 
									true 		=> "" 
								) ; 
	private $self_host  = array ( 	INIT 		=> "subscribe.php"  , 
									CITY 		=> "subscribe1.php" ,  
									CAPTCHA 	=> "subscribe2.php" ,
									CONFIRM 	=> "subscribe3.php"  
								)  ;
 
/**
* Some iterator functions
*
*/
	function rewind() {
	}
 
	function current() {
	}
 
	function key() {
	}
 
	static function next() {
		user_error("NEXT - Start[". self::$start ."] - Curr[". self::$curr ."] - Last[". self::$end ."]" , E_USER_NOTICE) ;
 
		if (self::$curr + 1 < self::$end)
			self::$curr++ ;
 
		user_error("NEXT - Start[". self::$start ."] - Curr[". self::$curr ."] - Last[". self::$end ."]" , E_USER_NOTICE) ;
		return(self::$curr) ;
	}
 
	static function prev() {
		user_error("PREV - Start[". self::$start ."] - Curr[". self::$curr ."] - Last[". self::$end ."]" , E_USER_NOTICE) ;
 
		if (self::$curr - 1 > 0)
			self::$curr-- ;
 
		user_error("PREV - Start[". self::$start ."] - Curr[". self::$curr ."] - Last[". self::$end ."]" , E_USER_NOTICE) ;
		return(self::$curr) ;
	}
 
	static function valid() {
		return( (self::$curr > 0) && (self::$curr < self::$end) ? true : false )  ; 
	}
/**
* Iterator functions
*
===================================================================================================================================/	

/**
* Subscribe Constructor
*
*/	
	function __construct($start, $end, $debug=false)
	{	$this->debug = $debug ;
 
		self::$start = max($start , self::$curr) ;
		self::$end   = $end  ;
 
	    self::$step    = 0 ;
 
		$this->execute() ;
	}
/**
* Subscribe Destructor
*
*/	
	function destruct()
	{    }
 
/**
* Subscribe Executor
*
*/	
	function execute()
	{
		try {	print("+++++++++++ [STATIC VARIABLES TEST]" . CRLF) ;  
/**
* Subscribe beginning
* ===================
*/	
				$this->message = "Rentrez les données afin de vous inscrire à votre site" ;
 
				if  (isset($_POST["subscribe_init"   ]) OR isset($_POST["subscribe_city"   ]) OR
					 isset($_POST["subscribe_captcha"]) OR isset($_POST["subscribe_confirm"]) )
					$this->validate() ;
print_r($_POST) ; echo CRLF ;
				if  (isset($_POST["subscribe_prev"]) )
					{	user_error("Browse[-1][0] Start[".self::$start."] - Curr[".self::$curr."] - End[".self::$end."]", E_USER_NOTICE);
						self::prev( ) ;
						user_error("Browse[-1][1] Start[".self::$start."] - Curr[".self::$curr."] - End[".self::$end."]", E_USER_NOTICE);
 
//						$this->inSert("----- [PREV]" , true ) ;  
					}
 
				if  (isset($_POST["subscribe_next"]) )
					{	user_error("Browse[+1][0] Start[".self::$start."] - Curr[".self::$curr."] - End[".self::$end."]", E_USER_NOTICE);
						self::next() ;
						user_error("Browse[+1][1] Start[".self::$start."] - Curr[".self::$curr."] - End[".self::$end."]", E_USER_NOTICE);
 
// 						$this->inSert("+++++ [NEXT]" , true ) ;  
					}
/**
* Subscribe ending
* ================
*/			} catch (Exception $E) 
				{ 
			   		throw Skeleton::display_exception($E) ; 
				}
 
	}
 
	function getMessage()
	{	return( $this->message ) ;  }
 
	function getSendAttr()
    {	return( $this->disenabled[false]) ; 	}
 
	function getHost()
    {	return( $this->self_host[self::$step] ) ; }
 
	static function getStart()
    {	return( self::$start ) ; }
 
	static function getCurr()
    {	return( self::$curr ) ; }
 
	static function getEnd()
    {	return( self::$end ) ; }
}
 
$sub = new Subscribe(0,3,$debug=true) ;
//------------------------------------------------------------------------------------------------------------------------------------- //
 
// =============================================================================================================================== //
//                                 Class Textarea                                                                                  //
// =============================================================================================================================== //
class Textarea  
{   private $field, $cols, $rows, $debug, $isrt = array() ;
 
	function __construct($field, $cols, $rows, $debug = true )
	{	$this->field   = $field ;
		$this->cols    = $cols ;
		$this->rows    = $rows ;
		$this->debug   = $debug ;
	}
 
	function __destruct() {
	}
 
	function show()
	{	echo '<textarea name="' . $this->field . '" 
	                    cols="' . $this->cols  . '" 
						rows="' . $this->rows  . '">' ;
 
		if (isset($_POST[ $this->field ])) echo $_POST[ $this->field ] ;
        echo '</textarea>';
 	}
 
	function clear()
	{	unset( $_POST[ $this->field ] ) ; 
		$this->isrt = array() ;
	}
 
	function setValue($value)
	{	$this->isrt[]          = $value ;          
		$_POST[ $this->field ] = $value ; }
 
	function getValue()
	{	return( $_POST[ $this->field ] ) ; }
 
	function inSert($val , $crlf=true)
	{	$val = $crlf ? $val . CRLF : $val ;
		if (isset( $_POST[ $this->field ] ) )
			$_POST[ $this->field ] .= $val ; 
		else
			$_POST[ $this->field ] = $val ; 
	}
//
// 	End of class: Textarea
//	======================
}
?>
<!-- ============================================================================================================================ -->
<!-- ===                        Style                                                                                         === -->
<!-- ============================================================================================================================ -->
<link href="../css/jecrapahute.css" rel="stylesheet" type="text/css">
<!-- ============================================================================================================================ -->
<style type="text/css">
<!--
.style3 {color: #333333}
-->
</style>
 
<form action="<?php echo $_SERVER['PHP_SELF'] ?>" method="post" name="subscribe_form" id="subscribe_id">
   	<table class="form_bkg border" align="center">
<!--
   	<tr height="21">
   		<td>
						<button name="subscribe_prev" type="submit" id="subscribe_prev">
							<img src="../buttons/prev_over.gif" width="40" height="40" id="suscribre_prev" title="Encodage du panneau suivant[INIT]"/>
						</button>
		</td>
   	    <td align="center" class="form_title">Test Static </td>
	    <td>			
						<button name="subscribe_next" type="submit" id="subscribe_next">
							<img src="../buttons/next_over.gif" width="40" height="40"  title="Encodage du panneau précédent[INIT]"/>
						</button>
			</td>
		</td>
   	</tr>
-->        
	<tr>
	   	<td>&nbsp;</td>
   	  	<td>
  		  	<table width="111%" class="form_bkg1 border">
    		<tr>
    		    <td align="center">&nbsp;</td>
    		    <td class="form_subtitle">STATIC VARIABLES TEST</td>
    		    <td align="center">&nbsp;</td>
  		    </tr>
 
			<tr>
    		    <td colspan="3" align="center">
					<?php 	$txt = new Textarea("textarea", 70 , 10) ;
							$txt->show() ;
					?>
    		    </td>
   		    </tr>
 
			<tr>
    		    <td colspan="3" align="center">&nbsp;</td>
   		    </tr>
 
			<tr>
    		  <td width="110" align="center"><?php echo $sub->getStart() ;  	?></td>
  		      <td width="220" align="center"><?php echo $sub->getCurr()  ;		?></td>
  		      <td width="110" align="center"><?php echo $sub->getEnd()   ;	 	?></td>
    		</tr>    			
 
			<tr>
   			  	<td colspan="3"><hr /></td>
			</tr>
 
			<tr>
   		  		<td colspan="3">
					<div align="center">
   			    		<input type="text" name="message" size="70" class="form_msg" value="<?php echo $sub->getMessage() ?>" readonly />
		    		</div>				</td>
			</tr>
			</table>
 		<hr />
      	<td>&nbsp;</td>
	</tr>
 
	<tr>
   		<td>
						<button name="subscribe_prev" type="submit" id="subscribe_prev">
							<img src="../buttons/prev_over.gif" width="40" height="40" id="suscribre_prev" title="Encodage du panneau suivant[INIT]"/>
						</button>
 
		</td>
		<td>&nbsp;
 
		</td>
		<td>
						<button name="subscribe_next" type="submit" id="subscribe_next">
							<img src="../buttons/next_over.gif" width="40" height="40"  title="Encodage du panneau précédent[INIT]"/>
							<?php $txt->inSert("++++++ NEXT") ; $txt->show() ; ?>
						</button>
		</td>
	</tr>
	</table>
</form>
<!-- ============================================================================================================================ -->
<!-- ===                        Body.                                                                                         === -->
<!-- ============================================================================================================================ -->
 
</body>
</html>
L'insertion s'effectue en ligne 305....

Si je déplace l'insertion en faisant:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
//
// 	End of class: Textarea
//	======================
}
	$txt = new Textarea("textarea", 70 , 10) ;
 
	if  (isset($_POST["subscribe_next"]) )
		{	$txt->inSert("++++++ NEXT") ; 
			$txt->show() ; 
		}
?>
Le texte est bien affiché mais dans TOUS LES CAS, pas dans le testarea définit par la dite-classe..... c con mais