[action.php?type=ajout Ajouter] | [action.php?type=modifier Modifier] | [action.php?type=suppression Supprimer]
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question[action.php?type=ajout Ajouter] | [action.php?type=modifier Modifier] | [action.php?type=suppression Supprimer]
Ajouter | Modifier | Supprimer
| |
<html> <head> <script type="text/javascript"> function Redirect(url) { document.getElementById("Formulaire").action.value = url; /* Pour le value je suis pas 100% sûr. Si ca marche pas essaye document.getElementById.action = url; */ document.getElementById("Formulaire").submit(); } </script> </head> ... </html>
document.getElementById.action = url;par
document.getElementById.action.value = url;
<html> <head> <script type= "text/javascript"> function Redirect(u) { document.getElementById("Formulaire").action = u; /* Pour le value je suis pas 100% sûr. Si ca marche pas essaye document.getElementById.action = url; */ alert(document.getElementById("Formulaire").action); document.getElementById("Formulaire").submit(); } </script> </head> <form id="Formulaire" action="" method="post"> Date installation | Identifiant | Nom PC | Affectation | Agence | Users | Mot_de_passe | Adresse IP | Raccordement domaine | Création Users | Base MP | MP_Intranet | MAJ_MP | Office | Symantec | VNC | Adobe Reader | Config. Boîte email | PDF Creator | <?php while ($tab = mysql_fetch_array($res)) { ?> ---- <?php echo $tab['date_installation'];?>, <?php echo $tab['identifiant'];?>, <?php echo $tab['nom_pc'];?>, <?php echo $tab['affectation'];?>, <?php echo $tab['agence'];?>, <?php echo $tab['users'];?>, <?php echo $tab['mot_de_passe'];?>, <?php echo $tab['adresse_ip'];?>, <?php echo $tab['raccordement_domaine'];?>, <?php echo $tab['creation_users'];?>, <?php echo $tab['base_mp'];?>, <?php echo $tab['mp_intranet'];?>, <?php echo $tab['maj_mp'];?>, <?php echo $tab['office'];?>, <?php echo $tab['symantec'];?>, <?php echo $tab['vnc'];?>, <?php echo $tab['adobe_reader'];?>, <?php echo $tab['config_boite_mail'];?>, <?php echo $tab['pdf_creator'];?>, "?>, <?php } ?> <center> | | </center> </form> </html>
<?php // Si on appel mapage.php pour ajouter un element // avec la variable d'url action et la valeur add // mapage.php?action= add if(isset($_GET['action']) and $_GET['action'] == 'add') { ?> <!-- Créer formulaire d ajout --> <?php } // Si on appel mapage.php pour éditer un element // avec la variable d'url action et la valeur edit // mapage.php?action=edit&id=NUM elseif(isset($_GET['action']) and $_GET['action'] == 'edit') { // SELECT * FROM table WHERE identifiant=$_GET['id'] ?> <!-- Créer formulaire de modification --> <?php } // Si on appel mapage.php pour supp un element // avec la variable d'url action et la valeur del // mapage.php?action=del&id=NUM // ou // mapage.php?action=del avec la var post choix elseif(isset($_GET['action']) and $_GET['action'] == 'del') { // Si l user clique sur un lien supprimé, il charge cette page avec l'information de suppression dans la variable d url id if(isset($_GET['id'])) { // DELETE WHERE identifiant=$_GET['id'] } // Si il clique en soumettant le formulaire (Bouton supprimer) c'est alors la variable POST choix qui contiendras un tableau des ID cochées elseif(isset($_POST['choix'])) { // Pour chaque choix dans le tableau $_POST['choix'] // DELETE WHERE identifiant=valeur choix } // Redirection vers mapage.php } else { // Si on appel mapage.php sans variables ?> <form id="Formulaire" name="Formulaire" method="post" action="mapage.php?action=del"> | Date installation | Identifiant | Nom PC | Affectation | Agence | Users | Mot_de_passe | Adresse IP | Raccordement domaine | Création Users | Base MP | MP_Intranet | MAJ_MP | Office | Symantec | VNC | Adobe Reader | Config. Boîte email | PDF Creator | <?php while ($tab = mysql_fetch_array($res)) { ?> ---- ">, <?php echo $tab['date_installation'];?>, <?php echo $tab['identifiant'];?>, <?php echo $tab['nom_pc'];?>, <?php echo $tab['affectation'];?>, <?php echo $tab['agence'];?>, <?php echo $tab['users'];?>, <?php echo $tab['mot_de_passe'];?>, <?php echo $tab['adresse_ip'];?>, <?php echo $tab['raccordement_domaine'];?>, <?php echo $tab['creation_users'];?>, <?php echo $tab['base_mp'];?>, <?php echo $tab['mp_intranet'];?>, <?php echo $tab['maj_mp'];?>, <?php echo $tab['office'];?>, <?php echo $tab['symantec'];?>, <?php echo $tab['vnc'];?>, <?php echo $tab['adobe_reader'];?>, <?php echo $tab['config_boite_mail'];?>, <?php echo $tab['pdf_creator'];?>, ---- [mapage.php?action=add Ajouter] | [javascript:; Supprimer] </center> </form> <script type="text/javascript"> <!--// J Ai pas vérifier si ca marche... :-D function checkUcheckAll(toCheck) { var mesCheck = document.Formulaire.choix; if(toCheck) { for (var i=0; i<mesCheck.length; i++) { mesCheck[i].checked = 'checked'; } } else { for (var i=0; i<mesCheck.length; i++) { mesCheck[i].checked = ''; } } } // --> </script> <?php } ?>