Redirection vers la même page

Fermé
coolvis - Modifié par jordane45 le 6/01/2015 à 16:55
jordane45 Messages postés 38173 Date d'inscription mercredi 22 octobre 2003 Statut Modérateur Dernière intervention 10 mai 2024 - 6 janv. 2015 à 16:58
Bonsoir tout le monde, je suis COULIBALY Donassi Clovis, étudint en informatique. j'effectue actuellement mon application de soutenance et je rencontre un problème d'affichage de page dans une cellule de mon tableau. En effet, j'ai une page contenu dans un tableau. Sur cette page se trouve un bouton de validation qui même à une autre page2. Le problème est que lors du clic sur ce bouton de soumission(validation), j'accède à une autre page2 sans problème. Mais Ce que je veux, c'est afficher cette autre page2 dans la même cellule que la page 1 du tableau.
Au lieu qu'elle s'ouvre ailleurs
Voici mes scripts.

nb: l'affichage doit se faire dans la cellule du include ($page) du tableau

page0:tableau
<?php
 session_start();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" href="../css/formulaire.css" type="text/css" />
<title>Page d'accueil parcinfosib</title>

</head>

<body bgcolor="#FFCC00">
 <table width="940" border="0" align="center">
  <tr height="150">
    <td colspan="2"></td>
  </tr>
  <tr height="25">
  <td colspan="2" align="center" >
  
  <?php
     $choix = 0; 
    if (isset($_GET['g'])) 
    { 
    $choix=$_GET['g']; 
    } 
    else{ 
    $choix=0; 
    } 
    switch ($choix) { 
    case 0:
     $page = "presentation.html";
     break; 
    case 1:
     $page = "materiel.php";
     break;
    case 6: 
     $page = "stock.php"; 
     break;
    case 8: 
     $page = "fiche_intervention.php"; 
     break;
    case 9:
     $page = "fiche_remplacement.php"; 
     break;
    case 10: 
     $page = "fiche_sortie_materiel.php"; 
     break;
    case 11: 
     $page = "rebus.php"; 
     break;
    case 13: 
     $page = "aide.html"; 
     break;
     case 14: 
     $page = "equipements.php"; 
     break;
      case 15: 
     $page = "list_intervention.php";  
     break;
     case 16: 
     $page = "list_remplacement.php"; 
     break;
     case 17: 
     $page = "list_sortie_materiel.php";
     break;
     case 18: 
     $page = "list_equipement.php";
     break;
     case 19: 
     $page = "list_besoins.php"; 
     break;
     case 20: 
     $page =  "list_fournisseurs.php";
     break;
     case 21: 
     $page = "list_livrer.php"; 
     break;
     case 22: 
     $page = "list_rebus.php";  
     break;

    default :
     $page = "presentation.html"; 
     break; 
    } 
    ?>
    
   <ul id="menuDeroulant"> 
    <li> 
    <a href="?g=1">Acquisition materiel</a> 
    </li>    
    <li> 
    <a href="#">Livraison</a> 
     <ul class="sousMenu"> 
      <li><a href="?g=6">Stock</a></li> 
     </ul> 
    </li>     
    <li> 
    <a href="?g=14">Affectation</a> 
    </li> 
    
    <li> 
    <a href="#">Maintenance</a> 
     <ul class="sousMenu"> 
   <!--  <li><a href="?g=8">Fiche d'intervention</a></li> 
      <li><a href="?g=9">Fiche de remplacement</a></li> -->
      <li><a href="?g=10">Fiche de sortie materiel</a></li> 
      <li><a href="?g=11">Mise au rébus</a></li> 
     </ul> 
    </li> 
    
    <li><a href="?g=13">Aide</a></li> 
   </ul> 
        
   </td>
  </tr>
  <tr height="25" align="center">
   <td colspan="2"><?php echo "Monsieur ".$_SESSION['nom']." "."  ,vous êtes connecté en tant qu'administrateur" ?></td>
  </tr>
  <tr height="25" align="center">
   <td colspan="8" class="clovis" align="center">
    <div align="center" style="color:#FF0000">LISTE DES ENREGISTREMENTS</div>
      <a href="?g=15">Interventions</a>
      <a href="?g=16">Remplacements materiel</a>
      <a href="?g=17">Sorties materiel</a>
      <a href="?g=18">Equipements affectés</a>
      <a href="?g=19">Besoins exprimés</a>
      <a href="?g=20">Fournisseurs</a>
      <a href="?g=21">Livraison</a>
      <a href="?g=22">Equipements au rébus</a> 
   </td>
  </tr>
   <div align="center">
  <tr> 
   <td align="center" height="500" style="overflow:auto;" bgcolor="#FFFFFF">
   <?php  
    include($page);
   ?>
   </td>  
  </tr>
  </div>
  <tr height="50" align="center">
   <td colspan="8" align="center"><?php include("footer.php")?></td>
  </tr>
 </table>
</body>
</html>

page1: equipements.php (ouvert après choix du menu affectation du tableau)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" href="../css/formulaire.css" type="text/css" />
<link rel="stylesheet" href="../css/message_traitement.css" type="text/css" />
<title>Equipements affectés</title>
</head>

<body>
<?php
 include("connexion.php");
 //ajouté
  try
  {
   $bdd = new PDO('mysql:host=localhost;dbname=parcinfosib', 'root', '');
  }
  catch (Exception $e)
  {
   die('Erreur : ' . $e->getMessage());
  }
 //fin ajouté
 //requêtes
// $reg=mysql_query("select * from materiel");

 //ajouté
$reponse = $bdd->query('SELECT * FROM materiel ');
?>
 <form method="post" action="details_eq.php">
 <fieldset>
 <legend>Affectation d'équipements</legend>
 <div>
 <table>
  <tr>
   <td>Numéro de serie de l'équipement</td>
  </tr>
  <tr>
  <td>
   <select name="materielid">
   <?php
    while ($donnees = $reponse->fetch())
                {
    echo '<option value="'.$donnees["mat_seri"].'">'.$donnees["mat_seri"].'</option>';
     $i=1;
            ?>

             <?php
   
                    $i++; 
    
                }
                $reponse->closeCursor();
            ?> <br/>
   
   </select>
   <input type="submit" value="Détails" />
  </td>
  </tr>
 </table>
 </div>
 </fieldset>
 </form>

</body>
</html>


page2: details_eq.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" href="../css/formulaire.css" type="text/css" />
<link rel="stylesheet" href="../css/message_traitement.css" type="text/css" />
<title>Equipement affecté</title>
</head>

<body>
 <?php 
 include('connexion.php');
  try
  {
   $bdd = new PDO('mysql:host=localhost;dbname=parcinfosib', 'root', '');
  }
  catch (Exception $e)
  {
   die('Erreur : ' . $e->getMessage());
  }
  
?>
 
 <?php
 include("connexion.php");
 $req1=mysql_query("select * from utilisateur");
 $req3=mysql_query("select * from stock");
?>
 <?php         
    //execution de la requete 
    
    if (isset($_POST['materielid']))
     {
     // on recupère les valeurs
      $select=$_POST['materielid'];
    }
          //      $reponse = $bdd->prepare('SELECT * FROM materiel where mat_seri="'.$select.'"');
     $reponse = $bdd->prepare('SELECT * FROM materiel where mat_seri=?');
    $reponse->execute(array($_POST['materielid']));
    $i=0;
                while ($donnees = $reponse->fetch())
                {
     $i++;    
   ?>         
<form  method="post" action="eq_insert.php">      
<fieldset>
 <legend>Détails de l'équipement</legend>
 <div>
 <table> 
 <tr>
 <td>
  Numéro de série
 </td>
 <td>
      <input type="text" readonly="text" name="mat_seri" value="<?php echo $donnees['mat_seri']; ?>"/>
 </td>
 </tr>
 <tr>
 <td>
  Nom de l'équipement
 </td>
 <td>
      <input type="text" readonly="text" name="mat_nom" value="<?php echo $donnees['mat_nom']; ?>"/>
 </td>
 </tr>
 <tr>
 <td>
  Marque de l'équipement
 </td>
 <td>
    <input type="text" readonly="text" name="mat_marq" value="<?php echo $donnees['mat_marq']; ?>"/>
 </td>
 </tr>
 <tr>
 <td>
  Modèle de l'équipement
 </td>
 <td>
      <input type="text" readonly="text" name="mat_mod" value="<?php echo $donnees['mat_mod']; ?>"/>
 </td>
 </tr>
 <tr>
 <td>
  Type d'équipement
 </td>
 <td>
    <input type="text" readonly="text" name="mat_typ" value="<?php echo $donnees['mat_typ']; ?>"/>
 </td>
 </tr>
      
   <tr>
   <td>Ut utilisateur recipiendaire</td>
   <td>
     <select name="util_ut">
       <?php
        while ($util_ut=mysql_fetch_array($req1))
        {
         echo '<option value="'.$util_ut["util_ut"].'">'.$util_ut["util_ut"].'</option>';
        }
       ?> 
     </select>     
   </td>
  </tr>
  <br/>
  <tr>
   <td>code stock</td>
   <td>
     <select name="stock_cod">
       <?php
        while ($stock_cod=mysql_fetch_array($req3))
        {
         echo '<option value="'.$stock_cod["stock_cod"].'">'.$stock_cod["stock_cod"].'</option>';
        }
       ?> 
     </select>     
   </td>
  </tr>
  <br/><br/>
  <tr>
   <td colspan="2"><input type="submit" value="Affecter" /> </td>
  </tr> 
      <?php
      //requête 
 //fermeture de la connexion  
                    $i++;   
                }
                $reponse->closeCursor();
            ?> 
  <tr>
  <td colspan="2" align="center">
    <?php
   if(isset($_GET["mess"]))
     {
    echo '<h5 class="texte">'.$_GET["mess"].'</h5>';
     }
    ?>
    <?php
   if(isset($_GET["mes"]))
     {
    echo '<h5 class="texte">'.$_GET["mes"].'</h5>';
     }
    ?>
  </td>  
    </tr> 
</table>
</div>
</fieldset>
</form> 
</body>
</html>
 

MERCI POUR LE COUP DE MAIN


EDIT : Ajout des balises de code
A voir également:

1 réponse

jordane45 Messages postés 38173 Date d'inscription mercredi 22 octobre 2003 Statut Modérateur Dernière intervention 10 mai 2024 4 665
6 janv. 2015 à 16:58
Bonjour,

1 - Penses à utiliser la coloration syntaxique lorsque tu postes du code sur le forum:
Merci de lire ceci : https://codes-sources.commentcamarche.net/faq/10686-le-nouveau-codes-sources-comment-ca-marche#balises-code


2 - Au lieu de mettre une redirection dans ta form
 <form method="post" action="details_eq.php">

Fait ton submit DANS cette même page
 <form method="post" action="">

et ajoute le code de ta page2 DANS ta page 1
1