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

Langage PHP Discussion :

Script Event & $_POST [PHP 5.3]


Sujet :

Langage PHP

  1. #1
    Débutant Avatar de ETVigan
    Homme Profil pro
    Conseil - Consultant en systèmes d'information
    Inscrit en
    Avril 2010
    Messages
    660
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Gard (Languedoc Roussillon)

    Informations professionnelles :
    Activité : Conseil - Consultant en systèmes d'information
    Secteur : Finance

    Informations forums :
    Inscription : Avril 2010
    Messages : 660
    Points : 170
    Points
    170
    Par défaut Script Event & $_POST
    Bonjour, j'ai souci avec un script que je suis entrain de ré-écrire et l'interception d'un évent intercepté via $_post ne se fait comme avant...
    Des prints et user_error, netbeans ne m'aide pas... bref je vous soumets mon souci

    Les parties de code que je considère comme des points de repère sont en gras

    Le code est censé valider une forme et n'est pas achevé !

    Voici les prints:
    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
     
    Form[__construct]
     
    Test de validation d'un formulaire
     
    Prénom 		
    Nom
     
     
    Form[addString][prenom]
    String[__construct][prenom]
    Form[addString][nom]
    String[__construct][nom]
    Form[initForm]
    String[initField]
    String[initField]
    No submit
    Voici une partie de mon script:
    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
    <?php
    	session_start() ;
    	$title = "Test Form" ;
    
    // ------------------------------------------------------------------------------------------------------------------------------------------------- //
    //                                      My stuff's                                                                                                   //
    // ------------------------------------------------------------------------------------------------------------------------------------------------- //
    	require_once $_SERVER['DOCUMENT_ROOT'] . "/config/equate.php";  
    /**
    * 	ERRORHANDLER constructor
    *
    */	
     	require_once $_SERVER['DOCUMENT_ROOT'] . "/class/Exception.php";  
     	require_once $_SERVER['DOCUMENT_ROOT'] . "/config/stack.php";  
    
    // ------------------------------------------------------------------------------------------------------------------------------------------------- //
    //                                      FORM                                                                                                         //
    // ------------------------------------------------------------------------------------------------------------------------------------------------- //
    /**
    * 	FORM: constructor
    *
    */	
    		class Form extends Exception
    		{	private $cnt = 0, $form, $formTitle ;
    			private $msg,  $tabMsg = array( 	VIDE  => "Pr&ecirc;t &acirc; recevoir l'encodade de votre formulaire"     ,
     												KO    => "Veuillez corriger les fautes/complètez votre formulaire"   ,
    												OK    => "Parfait, pas(plus) d'erreur(s) dans ce formulaire"   
    					 			   		  ) ;
    				
    			function __construct($formTitle)
    			{	$this->form = NULL ;
    				$this->cnt	= 0 ;
    				$this->msg  = VIDE ;
    				$this->formTitle = $formTitle ;
    				print("Form[__construct]" . CRLF) ;
    			}
    				
    /**
    * 	FORM: initForm
    *
    */			
    			function initForm()
    			{   print("Form[initForm]" . CRLF) ;
    				for($i = 0 ; $i < $this->cnt ; $i++) 
    				{	//print("Form[".$i."/".$this->cnt."]" . CRLF) ;
    					$this->form[$i]->initField() ;
    //					$this->form[$i]->isFilled() ;
    				}		
    				Stack::emptyStack() ;
    			}
    				
    /**
    * 	FORM: validateForm
    *
    */			
    			function validateForm()
    			{   print("Form[validateForm]" . CRLF) ;
    				for($i = 0 ; $i < $this->cnt ; $i++) 
    				{	print("Form Validate[".$i."/".$this->cnt."]" . CRLF) ;
    					$this->form[$i]->validateField() ;
    				}		
    			}
    				
    /**
    * 	FORM: addText
    *
    */			
    			function addText($fldName, $fldMust, $fldType, $fldError, $FldMinl, $fldMaxl)
    			{   print("Form[addText][$fldName]" . CRLF) ;
    				$this->form[$this->cnt++] = new Text($fldName, $fldMust, $fldType, $fldError, $FldMinl, $fldMaxl) ;
    			}
    				
    /**
    * 	FORM: addString
    *
    */			
    			function addString($fldName, $fldMust, $fldType, $fldError, $FldMinl, $fldMaxl)
    			{   print("Form[addString][$fldName]" . CRLF) ;
    				$this->form[$this->cnt++] = new String($fldName, $fldMust, $fldType, $fldError, $FldMinl, $fldMaxl) ;
    			}
    
    /**
    * 	FORM: all -__get Functions
    *
    */
    			function getTitle()
    			{	return($this->formTitle) ;	}
    /**
    * 	FORM: stack Error Functionss
    *
    */			
    			public function getStackError()            // Public car function appelée du formulaire...
    			{	return(Stack::getStackError()) ; }
    			
    			public function getMsg()                   // Public car function appelée du formulaire...
    			{	return($this->tabMsg[$this->msg]) ;  	
    			}
    			
    			public function isFormValid()
    			{ 	return(Stack::getCntStack() == 0) ;	}       
    //          ==================================		
    		}
    
    //	======================================================================================================================================================== //
    //	======================================================================================================================================================== //
    //										INTERFACE: Validator                                                                        //	
    //  ======================================================================================================================================================== //
    //	======================================================================================================================================================== //
    		interface MethodList
    		{	
    			function ValidateField() ;
    			function isFilled() ; 
    //			function mustFill() ;
    //			function chkRange() ;
    //			function stackMessage() ;
    		}
    				
    // ------------------------------------------------------------------------------------------------------------------------------------------------- //
    //                                      STRING                                                                                                       //
    // ------------------------------------------------------------------------------------------------------------------------------------------------- //
    /**
    * 	STRING: constructor
    *
    */			
    		class String implements MethodList
    		{	private $fldName, $fldMust, $fldType, $fldError, $fldMinl, $fldMaxl ;
    
    			function __construct($fldName, $fldMust, $fldType, $fldError, $fldMinl, $fldMaxl)
    			{	$this->fldName  = $fldName  ;
    				$this->fldMust  = $fldMust  ;
    				$this->fldName  = $fldName  ;
    				$this->fldName  = $fldName  ;
    				$this->fldName  = $fldName  ;
    				$this->fldName  = $fldName  ;
    
    				print("String[__construct][$fldName]" . CRLF ) ;
    			}
    				
    /**
    * 	STRING: initField
    *
    */			function initField()
    			{   print("String[initField]" . CRLF) ;
    			}
    			
    /**
    * 	FORM: validateField
    *
    */			
    			function validateField()
    			{   print("String[validateField]" . CRLF) ;
    			}
    				
    /**
    * 	STRING: isFilled
    *
    */
    			function isFilled()
    			{ 	$fi = (isset( $_POST["$this->fldName"] ) ) AND ($_POST["$this->fldName"] != NULL);
    				print("String[isFilled][$fi]" . CRLF) ;
    				return( $fi ) ; 
    			}
    		}
    		
    	$cf = new Form	("Test de validation d'un formulaire") ;
    // ------------------------------------------------------------------------------------------------------------------------------------------------- //
    //                                      HRML User Screen                                                                                             //
    // ------------------------------------------------------------------------------------------------------------------------------------------------- //
    	require_once $_SERVER['DOCUMENT_ROOT'] . "/config/htmltop.php";  
    	require_once $_SERVER['DOCUMENT_ROOT'] . "/user/panel.php";  
    	require_once $_SERVER['DOCUMENT_ROOT'] . "/config/htmlbot.php";  
    
    	$cf->addString( 	"prenom"	,  	MUST , 	aE    	, 	WARN 	,  3, 30   					) ;
    	$cf->addString( 	"nom"		,  	MUST , 	aE    	, 	WARN 	,  3, 30   				 	) ;
    	$cf->initForm() ;
    // ------------------------------------------------------------------------------------------------------------------------------------------------- //
    //                                      Events Form definitions                                                                                      //
    // ------------------------------------------------------------------------------------------------------------------------------------------------- //
    /**
    * 	Event[SUBMIT] definition
    *
    */
       	if (isset($_POST['SUBMIT']))
    		{	print("_POST" . CRLF) ;
    			$cf->validateForm() ;
    			if ($cf->isFormValid())
    				{	# Formulaire valide
    					user_error("FORM OK !" , E_USER_NOTICE) ;
    					print("FORM OK" . CRLF) ;
    					# Instruction ...
    				}
    			else 
    				{	# Sinon ...
    					user_error("FORM KO !" , E_USER_NOTICE) ;
    					print("FORM KO" . CRLF) ;
    					# Instruction ...
    				}
    		}
    	else
    		print("No submit" . CRLF) ;
    		
    // ------------------------------------------------------------------------------------------------------------------------------------------------- //
    ?>
    La forme avec le bouton submit...

    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
    <?php
    //
    //  Form definition (for validation purposes)
    //
    ?>
    <form action="<?php $_SERVER['PHP_SELF']; ?>" method="post" name="CheckForm">
    <table width="615" border="0">
      <tr>
        <td>&nbsp;</td>
        <td colspan="4"><div align="center"><b><?php echo $cf->getTitle() ?></b></div></td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td colspan="6"><hr /></td>
      </tr>
      <?php
      		if (!$cf->isFormValid())
    			{
      ?>
      <tr>
        <td height="104">&nbsp;</td>
        <td colspan="4" align="center">
            <textarea name="textarea" cols="70" rows="5"><?php echo $cf->getStackError()?></textarea>   
    	</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td colspan="6"><hr /></td>
      </tr>
      <?php
      			}
      ?>
      <tr>
        <td width="60">Prénom</td>
        <td width="130">
    		<input type="text" name="prenom" maxlength="32" value="<?php if (isset($_POST['prenom'])) echo $_POST['prenom'] ?>"/>	</td>
        <td width="127"><div align="center">Nom</div></td>
        <td width="149"><input type="text" name="nom"   maxlength="32" value="<?php if (isset($_POST['nom'])) echo $_POST['nom'] ?>" /></td>
        <td width="46">&nbsp;</td>
        <td width="62">&nbsp;</td>
      </tr>
      <tr>
        <td colspan="6"><hr/></td>
      </tr>
      <tr>
        <td><input type="reset"  name="effacer"   value="Effacer"/></td>
        <td colspan="4" align="center">
          <input type="text"   size=60 name="message"   value="<?php if (isset($cf)) echo $cf->getMsg() ?>" />    </td>
        <td><input type="submit" name="SUBMIT"   value="Envoyer"/></td>
      </tr>
    </table>
    </form>
    J'espère que vous pourrez aider...
    Merci @tous

  2. #2
    Débutant Avatar de ETVigan
    Homme Profil pro
    Conseil - Consultant en systèmes d'information
    Inscrit en
    Avril 2010
    Messages
    660
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Gard (Languedoc Roussillon)

    Informations professionnelles :
    Activité : Conseil - Consultant en systèmes d'information
    Secteur : Finance

    Informations forums :
    Inscription : Avril 2010
    Messages : 660
    Points : 170
    Points
    170
    Par défaut Révision - incompréhension !
    Bonjour, j'ai constaté des comportements bizarres dans mon script, du genre, je fonctionne maintenant et pas le coup suivant sans explication !
    J'ai décidé de mettre en commentaire des parties de code de celui-ci jusqu’au moment ou son comportement se stabilise.
    Ce moment est arrivé avec 1 question plus fondamentale sur le formulaire et ces boutons...
    Je commence par celle-ci après avoir affiché le script avec ces commentaires précédés des //1 ou /*1
    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
     
    <?php
    	session_start() ;
    	$title = "Test Form" ;
     
    // ------------------------------------------------------------------------------------------------------------------------------------------------- //
    //                                      My stuff's                                                                                                   //
    // ------------------------------------------------------------------------------------------------------------------------------------------------- //
    	require_once $_SERVER['DOCUMENT_ROOT'] . "/config/equate.php";  
    /**
    * 	ERRORHANDLER constructor
    *
    */	
     	require_once $_SERVER['DOCUMENT_ROOT'] . "/class/Exception.php";  
     	require_once $_SERVER['DOCUMENT_ROOT'] . "/config/stack.php";  
     
    // ------------------------------------------------------------------------------------------------------------------------------------------------- //
    //                                      FORM                                                                                                         //
    // ------------------------------------------------------------------------------------------------------------------------------------------------- //
    /**
    * 	FORM: constructor
    *
    */			class Form extends Exception
    		{	private $cnt = 0, $form, $formTitle ;
    			private $msg = VIDE, $tabMsg = array( 	VIDE  => "Pr&ecirc;t &acirc; recevoir l'encodade de votre formulaire"     ,
     													KO    => "Veuillez corriger les fautes/complètez votre formulaire"   ,
    												OK    => "Parfait, pas(plus) d'erreur(s) dans ce formulaire"   
    					 			   		  		) ;
     
    			function __construct($formTitle)
    			{	$this->formTitle = $formTitle ;
    				print("Form[__construct]" . CRLF) ;
    			}
     
    /**
    * 	FORM: initForm
    *
    */			
    			function initForm()
    			{   print("Form[initForm]" . CRLF) ;
    /*1
    				for($i = 0 ; $i < $this->cnt ; $i++) 
    				{	//print("Form[".$i."/".$this->cnt."]" . CRLF) ;
    					$this->form[$i]->initField() ;
    //					$this->form[$i]->isFilled() ;
    				}		
    				Stack::emptyStack() ;
    				$this->form = NULL ;
    				$this->cnt	= 0 ;
    				$this->msg  = VIDE ;
    */
     
    			}
     
    /**
    * 	FORM: validateForm
    *
    */			
    			function validateForm()
    			{   print("Form[validateForm]" . CRLF) ;
    /*1
    				for($i = 0 ; $i < $this->cnt ; $i++) 
    				{	print("Form Validate[".$i."/".$this->cnt."]" . CRLF) ;
    					$this->form[$i]->validateField() ;
    				}		
    */
    				return($this->isFormValid()) ;
    			}
     
    /**
    * 	FORM: addText
    *
    */			
    			function addText($fldName, $fldMust, $fldType, $fldError, $FldMinl, $fldMaxl)
    			{   
    /*1
    				print("Form[addText][$fldName]" . CRLF) ;
    				$this->form[$this->cnt++] = new Text($fldName, $fldMust, $fldType, $fldError, $FldMinl, $fldMaxl) ;
    */
    			}
     
    /**
    * 	FORM: addString
    *
    */			
    			function addString($fldName, $fldMust, $fldType, $fldError, $FldMinl, $fldMaxl)
    			{  
    /*1
    				print("Form[addString][$fldName]" . CRLF) ;
    				$this->form[$this->cnt++] = new String($fldName, $fldMust, $fldType, $fldError, $FldMinl, $fldMaxl) ;
    */
    			}
     
    /**
    * 	FORM: all -__get Functions
    *
    */
    			function getTitle()
    			{	return($this->formTitle) ;	}
    /**
    * 	FORM: stack Error Functionss
    *
    */			
    			public function getStackError()            // Public car function appelée du formulaire...
    			{	return(Stack::getStackError()) ; }
     
    			public function getMsg()                   // Public car function appelée du formulaire...
    			{	return($this->tabMsg[$this->msg]) ;  	
    			}
     
    			public function isFormValid()
    			{ 	return(Stack::getCntStack() == 0) ;	}       
    //          ==================================		
    		}
     
    //	======================================================================================================================================================== //
    //	======================================================================================================================================================== //
    //										INTERFACE: Validator                                                                        //	
    //  ======================================================================================================================================================== //
    //	======================================================================================================================================================== //
    		interface MethodList
    		{	
    			function ValidateField() ;
    			function isFilled() ; 
    //			function mustFill() ;
    //			function chkRange() ;
    //			function stackMessage() ;
    		}
     
    // ------------------------------------------------------------------------------------------------------------------------------------------------- //
    //                                      STRING                                                                                                       //
    // ------------------------------------------------------------------------------------------------------------------------------------------------- //
    /**
    * 	STRING: constructor
    *
    */			
    		class String //1 implements MethodList
    		{	private $fldName, $fldMust, $fldType, $fldError, $fldMinl, $fldMaxl ;
     
    			function __construct($fldName, $fldMust, $fldType, $fldError, $fldMinl, $fldMaxl)
    			{	$this->fldName  = $fldName  ;
    				$this->fldMust  = $fldMust  ;
    				$this->fldName  = $fldName  ;
    				$this->fldName  = $fldName  ;
    				$this->fldName  = $fldName  ;
    				$this->fldName  = $fldName  ;
     
    				print("String[__construct][$fldName]" . CRLF ) ;
    			}
     
    /**
    * 	STRING: initField
    *
    */			function initField()
    			{   print("String[initField]" . CRLF) ;
    			}
     
    /**
    * 	FORM: validateField
    *
    */			
    			function validateField()
    			{   $val = true ;
     
    				print("String[validateField]" . CRLF) ;
    				return($val) ;
    			}
     
    /**
    * 	STRING: isFilled
    *
    */
    			function isFilled()
    			{ 	$fi = (isset( $_POST["$this->fldName"] ) AND ($_POST["$this->fldName"] != NULL) );
    				print("String[isFilled][$fi]" . CRLF) ;
    				return( $fi ) ; 
    			}
    		}
     
    	$cf = new Form	("Test de validation d'un formulaire") ;
     
    	$cf->addString( 	"prenom"	,  	MUST , 	aE    	, 	WARN 	,  3, 30   					) ;
    	$cf->addString( 	"nom"		,  	MUST , 	aE    	, 	WARN 	,  3, 30   				 	) ;
    	$cf->initForm() ;
    // ------------------------------------------------------------------------------------------------------------------------------------------------- //
    //1	require_once $_SERVER['DOCUMENT_ROOT'] . "/config/htmltop.php";  
    	require_once $_SERVER['DOCUMENT_ROOT'] . "/user/panel.php";  
    //1	require_once $_SERVER['DOCUMENT_ROOT'] . "/config/htmlbot.php";  
    // ------------------------------------------------------------------------------------------------------------------------------------------------- //
    //                                      Events Form definitions                                                                                      //
    // ------------------------------------------------------------------------------------------------------------------------------------------------- //
    /**
    * 	Event[SUBMIT] definition
    *
    */
       	if (isset($_POST['RESEI']))
    		{	print("_POST - reset" . CRLF) ;
    			$cf->initForm() ;
    			user_error("FORM reset !" , E_USER_NOTICE) ;
    			print("FORM reset" . CRLF) ;
    		}
    	else
    		print("No Form RESET" . CRLF) ;
     
     
    /**
    * 	Event[SUBMIT] definition
    *
    */
       	if (isset($_POST['SUBMIT']))
    		{	print("_POST1" . CRLF) ;
    			user_error("FORM submit !" , E_USER_NOTICE) ;
    /*
    //1			if ($cf->validateForm())
    				{	# Formulaire valide
    					user_error("FORM OK !" , E_USER_NOTICE) ;
    					print("FORM OK" . CRLF) ;
    					# Instruction ...
    				}
    			else 
    				{	# Sinon ...
    					user_error("FORM KO !" , E_USER_NOTICE) ;
    					print("FORM KO" . CRLF) ;
    					# Instruction ...
    				}
    */
    		}
    	else
    		print("No submit" . CRLF) ;
     
    ?>
    Ce qui donne en display...

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    Form[__construct]
    Form[initForm]
      	
    	 
      		 
    Prénom 		
    Nom
    		  	 
    		
    No Form RESET
    _POST1
    Ce qui nous amène de suite à ma question principale

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    Quelle est la fonction de l'action "Rafraîchissement de l'écran"  de tous navigateurs ?
    Le fait de rafraîchir l'écran réinitialise t'il l'écran entièrement ?
    Je m'explique, je clique sur le bouton <envoyer> le print _POST1est affiché... normal
    Je rafraichis l'écran - F5 ou CTL-R - sous Firefox, j'obtiens la même impression alors que je m'attendais à lire P2 au lieu de P1... voir ci dessous...
    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
       	if (isset($_POST['SUBMIT']))
    //P1	{	print("_POST1" . CRLF) ;
    			user_error("FORM submit !" , E_USER_NOTICE) ;
    /*
    //1			if ($cf->validateForm())
    				{	# Formulaire valide
    					user_error("FORM OK !" , E_USER_NOTICE) ;
    					print("FORM OK" . CRLF) ;
    					# Instruction ...
    				}
    			else 
    				{	# Sinon ...
    					user_error("FORM KO !" , E_USER_NOTICE) ;
    					print("FORM KO" . CRLF) ;
    					# Instruction ...
    				}
    */
    		}
    	else
    //P2	print("No submit" . CRLF) ;
    Par rapport aux 'comportements bizarres de mon script, celui-ci s'est stabilié à partir du moment ou j'ai décommenté/recommenté l'inclusion des HTMLTOP et HTMLBOT qui ne sont que les instructions HTML avant et après l'inclusion de la forme proprement dite et c'est reproductible...
    Je ne comprends pas....

    Merci de bien vouloir m'éclairer, la lecture des cours HTML et Formulaires PHP ne m'a pas aidé

    Merci à tous et bonnes vacances

  3. #3
    Membre éprouvé

    Profil pro
    Inscrit en
    Juin 2007
    Messages
    748
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juin 2007
    Messages : 748
    Points : 1 022
    Points
    1 022
    Par défaut
    Je m'explique, je clique sur le bouton <envoyer> le print _POST1est affiché... normal
    Je rafraichis l'écran - F5 ou CTL-R - sous Firefox, j'obtiens la même impression alors que je m'attendais à lire P2 au lieu de P1... voir ci dessous...

    quand tu click sur F5, cela renvoi aussi les entêtes, le formulaire est envoyé avec les entêtes, donc c'est normal; pour palier à cela, une fois le formulaire traité tu peu utiliser la fonction Header('Location : mapage.php' ), qui va donc redirigé la page avec entête formulaire vers la page sans les entêtes, et du coup t'affichera bien P2; attention tu ne doit pas afficher de contenu html avant l'utilisation de Header;

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

Discussions similaires

  1. Scripts BASH &amp; commande Find
    Par GoodWear dans le forum Administration système
    Réponses: 2
    Dernier message: 09/10/2009, 09h25
  2. Réponses: 0
    Dernier message: 23/09/2008, 00h42
  3. [script.aculo.us] onUpdate Event ignoré
    Par escteban dans le forum Bibliothèques & Frameworks
    Réponses: 2
    Dernier message: 29/05/2008, 22h41
  4. Events "OnAuthenticate, ..." accessible via script
    Par mchicoix dans le forum XMLRAD
    Réponses: 10
    Dernier message: 09/02/2005, 16h50

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