problème include et variable
bonjour,
voila j ai une page menu.php ou j'effectue la recherche du produit , cela me renvoie sur une page produit_essai.php?page=test
via un include .
sur la page test.php en include j'affiche les infos du produit .
j'ai un bouton qui permet de renvoyer a la page test2.php toujours en include dans la page produit_essai.php?page=test2
pour afficher d'autre infos , mais la je n'arrive pas à transmettres les donnees de la page test à la page test 2
merci pour votre aide
page produit_essai.php
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
|
<?php
session_start()
?>
<?php
$VALEUR_hote='';
$VALEUR_nom_bd=';
$VALEUR_user='';
$VALEUR_mot_de_passe='';
$connexion = new PDO('mysql:host='.$VALEUR_hote.';dbname='.$VALEUR_nom_bd, $VALEUR_user, $VALEUR_mot_de_passe);
?>
<?php
$resultats=$connexion->query("SELECT * FROM users WHERE login ='" . $_SESSION['login'] . "'");
$resultats->setFetchMode(PDO::FETCH_OBJ);
while( $result = $resultats->fetch() )
{
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Document sans titre</title>
</head>
<body>
<?php
$produit = $_POST["produit"] ;
$produit = addslashes( $produit ) ;
$resultats=$connexion->query("SELECT * FROM Produit WHERE ref_client = '".$produit."'");
$resultats->setFetchMode(PDO::FETCH_OBJ);
while( $result = $resultats->fetch() )
{
?>
<?php
if ($_GET['page'] == "test")
{
include("test.php");
}
if ($_GET['page'] == "test2")
{
include("test2".$_POST["produit"].".php");
}
?>
</body>
</html>
<?php
}
$resultats->closeCursor();
?>
<?php
}
$resultats->closeCursor();
?> |
page test
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13
| <!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Document sans titre</title>
</head>
<body>
<h1>Fiche produit 1<?php echo ($result->ref_client);?> <?php echo ($result->nom_origine);?></h1>
<a href="produit_essai.php?page=test2">fiche 2</a>
</body>
</html> |
page test 2
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Document sans titre</title>
</head>
<body>
<h1>Fiche produit 2<?php echo ($result->ref_client);?> <?php echo ($result->nom_origine);?></h1>
<a href="produit_essai.php?page=test">fiche 1</a>
</body>
</html> |
merci