1

For now, I'm working on an users managment page.

When an admin chooses to delete a user, I did create alert and confirmation popups to be sure the actions are done.

I have a form, and 2 buttons

<td colspan="2">
<input type="submit" value="modifier" name="modifier" onclick="return sure()"> ou
<input type="submit" value="supprimer" name="supprimer" onclick="return sure2()">
</td>

and several JS functions like :

<script>
  function sure(){
      alert("L'utilisateur <?php echo $nom->nom ;?> <?php echo $prenom->prenom ;?> a bien été modifié.");
  }
  function sure2(){
     var result=confirm("Etes-vous sur de vouloir supprimer <?php echo $nom->nom ;?> <?php echo $prenom->prenom ;?> ?")
     if (result==true)
     {

         alert("Suppression effectuée")
                     close
         window.open ("admin_modif_user.php") (to be opened in the same tab after closing the deletion page)

     }
     else
     {
        return false;
     }
  }
  </script>

The thing I want to do is when the admin click "no" (the return false) he's redirected on the list showing the users (a certain php page), and the same for when the admin click on the last OK to aknowlege the deletion.

Hope you understand my question, it surely can be a little confusing.

Thanks in advance :)

CBroe
  • 91,630
  • 14
  • 92
  • 150
31290
  • 45
  • 1
  • 10
  • see this http://stackoverflow.com/questions/1865837/whats-the-difference-between-window-location-and-window-location-replace – Gaurav Sharma Jul 25 '13 at 14:58

1 Answers1

0

You can use this to redirect the user (if this is what you mean)

window.location.href = "an_other_page.php"; 
mguimard
  • 1,881
  • 13
  • 14
  • Hi thanks for your quick answer. That's I wanna do but before, I want to the page to be closed and the new one in the same tab... – 31290 Jul 25 '13 at 15:03
  • How would you want a page to be opened in a tab you've just close ? That makes no sense. All you can do is open a new tab and close the current (which also makes no sense) – mguimard Jul 25 '13 at 15:11
  • Indeed that's what I want to do. A first page (Administration/admin_modif_user.php?id=1) is opened the deletion is done and generate an other page (Administration/admin_modif_user.php?id=1&modifier=1). From there, I want the original page (Administration/admin_modif_user.php) to be opened as soon as the admin clicked OK on the alert box. I tried with window.location.replace / window.location.href / close / self attribute... None did the work – 31290 Jul 25 '13 at 15:39