liste des forums liste des discussions Participer à la discussion
Message publié le mercredi 19 juillet 2006 - 11h16 par telnes. toujours revenir au debut - http://telnesmaster.free.fr/allhtml/index2.html - http://telnesmaster.free.fr/litetemplate - http://www.hotcontest.org <html> <body> <form method="POST" action="traitement1.php" name="monform"> Nom : <input type="text" name="nom" ></br> prenom : <input type="text" name="prenom" ></br> age : <input type="text" name="age" ></br> <input type="submit" value="go"> </form> </body> </html> <?php //on récupère nos valeurs $nom = $_POST['nom']; $prenom = $_POST['prenom']; $age = $_POST['age']; //on les affiches echo 'nom : '.$nom.'</br>'; echo 'prenom : '.$prenom.'</br>'; echo 'age : '.$age.'</br>'; ?> <html> <body> <form method="POST" action="traitement2.php" name="monform"> <!-- parametres de l exemple 1 --> Nom : <input type="text" name="nom" ></br> prenom : <input type="text" name="prenom" ></br> age : <input type="text" name="age" ></br> <!-- nouveaux parametres --> langue(s) parlées : </br> francais <input type="checkbox" name="langue[]" value="fr"></br> anglais <input type="checkbox" name="langue[]" value="eng"></br> portugais <input type="checkbox" name="langue[]" value="por"></br> espagniol <input type="checkbox" name="langue[]" value="esp"></br> <input type="submit" value="go"> </form> </body> </html> <?php //on récupère nos valeurs $nom = $_POST['nom']; $prenom = $_POST['prenom']; $age = $_POST['age']; //on récupère le tableau des langues $tab_lang = $_POST['langue']; //$tab_lang est un tableau !!!! //on les affiches echo 'nom : '.$nom.'</br>'; echo 'prenom : '.$prenom.'</br>'; echo 'age : '.$age.'</br>'; echo 'langue(s) cochée(s) : '; //affichage des langues cochées //pour plus de précision sur foreach [url=http://fr.php.net/manual/fr/control-structures.foreach.php]http://fr.php.net/manual/fr/control-structures.foreach.php[/url] foreach($tab_lang as $lang){ echo $lang.' '; } ?> <html> <body> <form method="POST" action="traitement3.php" name="monform"> <!-- parametres de l exemple 1 --> Nom : <input type="text" name="nom" ></br> prenom : <input type="text" name="prenom" ></br> age : <input type="text" name="age" ></br> <!-- nouveaux parametres --> langue(s) parlées : </br> francais <input type="checkbox" name="langue[fr]" value="francais"></br> anglais <input type="checkbox" name="langue[eng]" value="anglais"></br> portugais <input type="checkbox" name="langue[por]" value="portugais"></br> espagniol <input type="checkbox" name="langue[esp]" value="espagniol"></br> <input type="submit" value="go"> </form> </body> </html> <?php //on récupère nos valeurs $nom = $_POST['nom']; $prenom = $_POST['prenom']; $age = $_POST['age']; //on récupère le tableau des langues $tab_lang = $_POST['langue']; //$tab_lang est un tableau !!!! //on les affiches echo 'nom : '.$nom.'</br>'; echo 'prenom : '.$prenom.'</br>'; echo 'age : '.$age.'</br>'; echo 'langue(s) cochée(s) : '; //affichage des langues cochées //pour plus de précision sur foreach [url=http://fr.php.net/manual/fr/control-structures.foreach.php]http://fr.php.net/manual/fr/control-structures.foreach.php[/url] foreach($tab_lang as $key=>$lang){ echo $lang.'('.$key.') '; } ?> <select name="pays[]" size="4" multiple> <option value="fr">france</option> <option value="eng">angleterre</option> <option value="esp">espagne</option> <option value="por">portugal</option> </select> $age = (is_numeric($_POST['age']) && !empty($_POST['age']))?$_POST['age']:'error'; if( is_numeric($_POST['age']) && !empty($_POST['age']) ){ $age = $_POST['age']; } else{ $age = 'error'; } $tab_lang = (isset($_POST['langue']))?$_POST['langue']:array(); //debug code echo 'Var POST : '.count($_POST).'<pre>'; print_r($_POST); echo '</pre>'; echo 'Var GET : '.count($_GET).'<pre>'; print_r($_GET); echo '</pre>'; //fin debug
Message publié le mercredi 19 juillet 2006 - 14h06 par doula. D[;)]ula. :: Piano Service [ http://www.pianoservice.fr ] :: UCEM [ http://www.u-c-e-m.com ] :: Ere du Temps [ http://www.ere-du-temps.com ]
Message publié le samedi 02 septembre 2006 - 17h15 par gaeil.
Message publié le lundi 28 juillet 2008 - 03h37 par moldave.
Message publié le lundi 28 juillet 2008 - 13h00 par telnes. toujours revenir au debut - http://telnesmaster.free.fr/allhtml/index2.html - http://telnesmaster.free.fr/litetemplate - http://www.hotcontest.org
<form action="monForm.php" method="GET">
<input type="text" name="chp1" value="test">
<input type="submit" value="envoyer">
</form>
<?php
if(isset($_GET['chp1'])){ echo 'je traite les datas';}
?>
Message publié le mardi 02 décembre 2008 - 14h42 par Akharawaka. liste des forums liste des discussions Participer à la discussion
Vous devez obligatoirement vous identifier en tant que membre pour participer à cette discussion.