Précédent   Forum des professionnels en informatique > PHP > PHP & SGBD > PHP & MySQL
PHP & MySQL Forum d'entraide sur les fonctions MySQL avec PHP. Avant de poster -> FAQ MySQL, Cours MySQL et Sources MySQL. Pour les questions concernant le moteur MySQL plutôt que les fonctions PHP, merci d'utiliser le forum MySQL.
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 27/06/2011, 15h00   #1
 
Homme khmaies guesmi
Étudiant
Inscription : avril 2011
Messages : 63
Détails du profil
Informations personnelles :
Nom : Homme khmaies guesmi
Localisation : Tunisie

Informations professionnelles :
Activité : Étudiant
Secteur : High Tech - Opérateur de télécommunications

Informations forums :
Inscription : avril 2011
Messages : 63
Points : -3
Points : -3
Par défaut button de confirmation

Bonjours,

SVP ,qui peut m'aider, j'ai un script php et je voudrai lorsque j'appuis sur le boutton "supprimer" ou "signaler rebu", il m 'apparaitre une fenetre de confirmation
voici le code et merci d'avance
Code :
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
<?php
session_start();
include("connexion.php");
connect($host,$user,$mot_passe,$db_name);
if ( !session_is_registered("authen_user")){
#echo '<META HTTP-EQUIV="refresh" CONTENT="0;URL=index.php?erreur=404">';
#redirection instantanée
header("location:index.php?erreur=404");
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<link href="css/style.css" rel="stylesheet">
<title></title>
</head>
<body topmargin="0" leftmargin="0">
&nbsp;
<table width="1100" height="902"  border="0" align="center" cellpadding="0" cellspacing="0" bordercolor="#111111" bgcolor="#FFFFFF" style="border-collapse: collapse">
<tr>
    <td width="100%" height="126" align="left" valign="top">
         <table WIDTH="1100" BORDER="0" CELLPADDING="0" CELLSPACING="0">
            <tr>
                <td COLSPAN="6"><img SRC="img/header.jpg" WIDTH="387" HEIGHT="94"></td>
           </tr>
	       <tr>
             <td width="89"><a class="linx" href="user_home.php">Consultation  </a></td>
                <td width="111"><a class="linx" href="new.php">Ajouter nouveau</a></td>
                <td width="80"><a class="linx" href="find.php">Recherche</a></td>
             <td width="425"><a class="linx" href="mail.php">Exportation Excel</a></td>
               <td width="175"><a class="linx" href="#6"></a></td>
               <td width="87"><a class="linx" href="deco.php">D&eacute;connecxion</a></td>
          </tr>
		  <tr>
		    <td COLSPAN="6">&nbsp;</td>
		   </tr>
      </table>
    </td>
</tr>
<tr>
     <td  valign="top"><hr>
	 <table width="1100"  BORDER="1" bordercolor="#BDE7F7" CELLPADDING="0" CELLSPACING="0">
	   <tr>
	     <th width="39"><p align="left" class=text2>N&deg;</th><th width="108"><p align="left" class=text2>N&deg; de s&eacute;rie</th><th width="122" ><p align="left" class=text2>N&deg;d'immo</th><th width="121" ><p align="left" class=text2>Date de  r&eacute;ception</th><th width="93"><p align="left" class=text2>statut affectation</th><th width="95"><p align="left" class=text2>statut Pc</th><th width="228"><p align="left" class=text2><strong>b&eacute;n&eacute;ficiaire</strong></th><th width="121"><p align="left" class=text2>Modifier  statut Affectation</th><th width="153"><p align="left" class=text2>Modifier  statut pc</th>
	   </tr>
	   <?php
	   $sql="select * from pc";
	   $rs=mysql_query("$sql");
	   $i=1;
	   while($tab=mysql_fetch_array($rs))
	   { 
 
	     echo "<tr>";
		 echo "<td valign=top><p class=text2>$i</td>";
	     echo "<td valign=top><p class=text2>$tab[1]</td>";
		 echo "<td valign=top><p class=text2>$tab[2]</td>";
		 echo "<td valign=top><p class=text2>$tab[9]</td>";
		 echo "<td valign=top><p class=text2>$tab[7]</td>";
		 echo "<td valign=top><p class=text2>$tab[8]</td>";
		 echo "<td><p class=text2><img src=img/arrow1.gif border=0> Nom :$tab[3]<br>
		 <img src=img/arrow1.gif border=0> Pr&eacute;nom :$tab[4]<br> 
		 <img src=img/arrow1.gif border=0> N°Command :$tab[11]<br> <img src=img/arrow1.gif border=0> matricule :$tab[5] <br> <img src=img/arrow1.gif border=0> Service/UF :$tab[6]<br><img src=img/arrow1.gif border=0> Date d'affectation :$tab[10]
		 </td>";
		 echo "<td valign=top><p class=text2>
		 <a class=linx href=affect.php?id=$tab[0]>Affecter</a><br>
		 <a class=linx href=update.php?id=$tab[0]>Signaler Libre</a><br>
		 <a class=linx href=delet.php?id=$tab[0]>Supprimer</a><br>
		 </td>";
 
		 echo "<td valign=top><p class=text2>
		 <a class=linx href=update3.php?id=$tab[0]>Signaler fonctionnel</a><br>
		 <a class=linx href=updat4.php?id=$tab[0]>Signaler en reparation</a><br>
		 <a class=linx href=update2.php?id=$tab[0]>Signaler rebut</a><br>
 
		 </td>";
	     echo "</tr>";
		 $i++;
		 function confirm(){
           $question = 'Etes-vous sur de vouloir supprimer  ' ;
         $confirmation = confirm($question) ;
 
            if($confirmation = true){
          return true;
   }
   <?php
		  while ($tab[7]="supprimer" £tab[8]="signaler rebut"){
   ?>
		<INPUT TYPE="button" ONCLICK="if ( confirm('vous êtes sûr ?') ) location.href='../../index.php';"NAME="submit2" VALUE="confirmer" />
		}
	<?php
	   }
	 ?>
	   ?>
 
	 </table>
 
    </td>	   
</tr>
</table>
</body>
</html>
pfakhmaies est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 27/06/2011, 15h04   #2
Invité régulier
 
Homme ben
Développeur informatique
Inscription : avril 2009
Messages : 53
Détails du profil
Informations personnelles :
Nom : Homme ben
Localisation : France

Informations professionnelles :
Activité : Développeur informatique
Secteur : High Tech - Éditeur de logiciels

Informations forums :
Inscription : avril 2009
Messages : 53
Points : 7
Points : 7
Pour une boîte de dialogue, utilise le javascript
shadow578 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 27/06/2011, 15h06   #3
Membre actif
 
Homme
Inscription : avril 2011
Messages : 426
Détails du profil
Informations personnelles :
Sexe : Homme

Informations forums :
Inscription : avril 2011
Messages : 426
Points : 171
Points : 171
Citation:
Envoyé par pfakhmaies Voir le message
Bonjours,

SVP ,qui peut m'aider, j'ai un script php et je voudrai lorsque j'appuis sur le boutton "supprimer" ou "signaler rebu", il m 'apparaitre une fenetre de confirmation
voici le code et merci d'avance
Code :
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
<?php
session_start();
include("connexion.php");
connect($host,$user,$mot_passe,$db_name);
if ( !session_is_registered("authen_user")){
#echo '<META HTTP-EQUIV="refresh" CONTENT="0;URL=index.php?erreur=404">';
#redirection instantanée
header("location:index.php?erreur=404");
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<link href="css/style.css" rel="stylesheet">
<title></title>
</head>
<body topmargin="0" leftmargin="0">
&nbsp;
<table width="1100" height="902"  border="0" align="center" cellpadding="0" cellspacing="0" bordercolor="#111111" bgcolor="#FFFFFF" style="border-collapse: collapse">
<tr>
    <td width="100%" height="126" align="left" valign="top">
         <table WIDTH="1100" BORDER="0" CELLPADDING="0" CELLSPACING="0">
            <tr>
                <td COLSPAN="6"><img SRC="img/header.jpg" WIDTH="387" HEIGHT="94"></td>
           </tr>
	       <tr>
             <td width="89"><a class="linx" href="user_home.php">Consultation  </a></td>
                <td width="111"><a class="linx" href="new.php">Ajouter nouveau</a></td>
                <td width="80"><a class="linx" href="find.php">Recherche</a></td>
             <td width="425"><a class="linx" href="mail.php">Exportation Excel</a></td>
               <td width="175"><a class="linx" href="#6"></a></td>
               <td width="87"><a class="linx" href="deco.php">D&eacute;connecxion</a></td>
          </tr>
		  <tr>
		    <td COLSPAN="6">&nbsp;</td>
		   </tr>
      </table>
    </td>
</tr>
<tr>
     <td  valign="top"><hr>
	 <table width="1100"  BORDER="1" bordercolor="#BDE7F7" CELLPADDING="0" CELLSPACING="0">
	   <tr>
	     <th width="39"><p align="left" class=text2>N&deg;</th><th width="108"><p align="left" class=text2>N&deg; de s&eacute;rie</th><th width="122" ><p align="left" class=text2>N&deg;d'immo</th><th width="121" ><p align="left" class=text2>Date de  r&eacute;ception</th><th width="93"><p align="left" class=text2>statut affectation</th><th width="95"><p align="left" class=text2>statut Pc</th><th width="228"><p align="left" class=text2><strong>b&eacute;n&eacute;ficiaire</strong></th><th width="121"><p align="left" class=text2>Modifier  statut Affectation</th><th width="153"><p align="left" class=text2>Modifier  statut pc</th>
	   </tr>
	   <?php
	   $sql="select * from pc";
	   $rs=mysql_query("$sql");
	   $i=1;
	   while($tab=mysql_fetch_array($rs))
	   { 
 
	     echo "<tr>";
		 echo "<td valign=top><p class=text2>$i</td>";
	     echo "<td valign=top><p class=text2>$tab[1]</td>";
		 echo "<td valign=top><p class=text2>$tab[2]</td>";
		 echo "<td valign=top><p class=text2>$tab[9]</td>";
		 echo "<td valign=top><p class=text2>$tab[7]</td>";
		 echo "<td valign=top><p class=text2>$tab[8]</td>";
		 echo "<td><p class=text2><img src=img/arrow1.gif border=0> Nom :$tab[3]<br>
		 <img src=img/arrow1.gif border=0> Pr&eacute;nom :$tab[4]<br> 
		 <img src=img/arrow1.gif border=0> N°Command :$tab[11]<br> <img src=img/arrow1.gif border=0> matricule :$tab[5] <br> <img src=img/arrow1.gif border=0> Service/UF :$tab[6]<br><img src=img/arrow1.gif border=0> Date d'affectation :$tab[10]
		 </td>";
		 echo "<td valign=top><p class=text2>
		 <a class=linx href=affect.php?id=$tab[0]>Affecter</a><br>
		 <a class=linx href=update.php?id=$tab[0]>Signaler Libre</a><br>
		 <a class=linx href=delet.php?id=$tab[0]>Supprimer</a><br>
		 </td>";
 
		 echo "<td valign=top><p class=text2>
		 <a class=linx href=update3.php?id=$tab[0]>Signaler fonctionnel</a><br>
		 <a class=linx href=updat4.php?id=$tab[0]>Signaler en reparation</a><br>
		 <a class=linx href=update2.php?id=$tab[0]>Signaler rebut</a><br>
 
		 </td>";
	     echo "</tr>";
		 $i++;
		 function confirm(){
           $question = 'Etes-vous sur de vouloir supprimer  ' ;
         $confirmation = confirm($question) ;
 
            if($confirmation = true){
          return true;
   }
   <?php
		  while ($tab[7]="supprimer" £tab[8]="signaler rebut"){
   ?>
		<INPUT TYPE="button" ONCLICK="if ( confirm('vous êtes sûr ?') ) location.href='../../index.php';"NAME="submit2" VALUE="confirmer" />
		}
	<?php
	   }
	 ?>
	   ?>
 
	 </table>
 
    </td>	   
</tr>
</table>
</body>
</html>
Salut,

Tu devrais mettre ton code dans la balise code.

Ensuite, pour la confirmation, il s'agit de javascript. Fait une recherche avec la commande javascript return confirm('')

Bonne chance
heretik25 est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 01h57.


 
 
 
 
Partenaires

Hébergement Web