Aller au contenu

recuperation de variables


nolog

Sujets conseillés

Bonsoir,

mon but et de recuperer les variables de ma session de page 1 est de les afficher a la page 2 mais je n'ai comme resultat que :

photo:

Marque:

prix:

si un initié peut me filer un coup de pouce svp merci.

dans 1 page j'ouvre une session:

-----------------------------------------------------------------------------------------------------

<?php session_start()?>

$http_SESSION_VARS['photo'] = $row_ttleshome['marque'];
$http_SESSION_VARS['marque']=$row_ttleshome['marque'];
$http_SESSION_VARS['desciptif']=$row_ttleshome['marque'];

---------------------------------------------------------------------------------------------------

dans la page 2 :

<?php 
 
session_start();
 
echo 'photo:',$http_SESSION_VARS['photo'],'<br/>
        Marque:',$http_SESSION_VARS['marque'],'<br/>
        Prix:',$http_SESSION_VARS['prix'],'<br/>';
?>

Lien vers le commentaire
Partager sur d’autres sites

<?
session_start()
$_SESSION['photo'] = $row_ttleshome['marque'];
$_SESSION['marque']=$row_ttleshome['marque'];
$_SESSION['desciptif']=$row_ttleshome['marque'];
?>

---------------------------------------------------------------------------------------------------

dans la page 2 :

<?
session_start();
 
echo 'photo:'.$_SESSION['photo'].'<br/>
        Marque:'.$_SESSION['marque'].'<br/>
        Prix:'.$_SESSION['prix'].'<br/>';
?>

à supposer que ton tableau $row_ttleshome ne soit pas vide ;)

Modifié par hcplayer
Lien vers le commentaire
Partager sur d’autres sites

bonsoir hcplayer,

j'ai suivi ton conseils et maintenant j'ai comme resultat de la page 2:

-----------------------------------------------------------------------------

Marque:'.$_SESSION['marque'].'

Prix:'.$_SESSION['prix'].'

'; ?>

-----------------------------------------------------------------------------------

en fait tout le code de ma page 1 est: (generer par dreamweaver)


<?
session_start()
$http_SESSION_VARS['photo'] = $row_ttleshome['marque'];
$http_SESSION_VARS['marque']=$row_ttleshome['marque'];
$http_SESSION_VARS['desciptif']=$row_ttleshome['marque'];

?>
<?php require_once('Connections/destock.php'); ?>
<?php
$maxRows_ttlesecrans = 10;
$pageNum_ttlesecrans = 0;
if (isset($_GET['pageNum_ttlesecrans'])) {
 $pageNum_ttlesecrans = $_GET['pageNum_ttlesecrans'];
}
$startRow_ttlesecrans = $pageNum_ttlesecrans * $maxRows_ttlesecrans;

mysql_select_db($database_destock, $destock);
$query_ttlesecrans = "SELECT * FROM home";
$query_limit_ttlesecrans = sprintf("%s LIMIT %d, %d", $query_ttlesecrans, $startRow_ttlesecrans, $maxRows_ttlesecrans);
$ttlesecrans = mysql_query($query_limit_ttlesecrans, $destock) or die(mysql_error());
$row_ttlesecrans = mysql_fetch_assoc($ttlesecrans);



if (isset($_GET['totalRows_ttlesecrans'])) {
 $totalRows_ttlesecrans = $_GET['totalRows_ttlesecrans'];
} else {
 $all_ttlesecrans = mysql_query($query_ttlesecrans);
 $totalRows_ttlesecrans = mysql_num_rows($all_ttlesecrans);
}
$totalPages_ttlesecrans = ceil($totalRows_ttlesecrans/$maxRows_ttlesecrans)-1;

$maxRows_ttleshome = 10;
$pageNum_ttleshome = 0;
if (isset($_GET['pageNum_ttleshome'])) {
 $pageNum_ttleshome = $_GET['pageNum_ttleshome'];

}
$startRow_ttleshome = $pageNum_ttleshome * $maxRows_ttleshome;

mysql_select_db($database_destock, $destock);
$query_ttleshome = "SELECT * FROM cinema";
$query_limit_ttleshome = sprintf("%s LIMIT %d, %d", $query_ttleshome, $startRow_ttleshome, $maxRows_ttleshome);
$ttleshome = mysql_query($query_limit_ttleshome, $destock) or die(mysql_error());
$row_ttleshome = mysql_fetch_assoc($ttleshome);

if (isset($_GET['totalRows_ttleshome'])) {
 $totalRows_ttleshome = $_GET['totalRows_ttleshome'];
} else {
 $all_ttleshome = mysql_query($query_ttleshome);
 $totalRows_ttleshome = mysql_num_rows($all_ttleshome);
}
$totalPages_ttleshome = ceil($totalRows_ttleshome/$maxRows_ttleshome)-1;
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><!-- InstanceBegin template="/Templates/model2.dwt.php" codeOutsideHTMLIsLocked="false" -->
<head>
<!-- InstanceBeginEditable name="doctitle" -->
<title>Untitled Document</title>
<!-- InstanceEndEditable --><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
 if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
   document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
 else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_findObj(n, d) { //v4.01
 var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
   d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
 if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
 for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
 if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v6.0
 var i,p,v,obj,args=MM_showHideLayers.arguments;
 for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
   if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
   obj.visibility=v; }
}
//-->
</script>
<style type="text/css">
<!--
body {
margin-left: 0px;
margin-top: 0px;
}
.style9 {font-size: 14px}
.style25 {
font-size: 12px;
font-weight: bold;
color: #666666;
}
.style28 {font-family: Verdana, Arial, Helvetica, sans-serif}
.style30 {color: #999999}
.style33 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; font-weight: bold; color: #666666; }
.style34 {
font-family: Verdana;
font-weight: bold;
}
.style35 {color: #000000}
.style36 {color: #666666}
.style37 {font-family: Verdana}
.style38 {font-family: Verdana; font-size: 14px; }
.style40 {color: #666666; font-weight: bold;}
a:link {
color: #666666;
text-decoration: none;
}
a:visited {
color: #004000;
text-decoration: none;
}
-->
</style>
<!-- InstanceBeginEditable name="head" -->
<style type="text/css">
<!--
.style41 {font-weight: bold}
.style42 {
color: #FFCEB7;
font-weight: bold;
font-size: 14px;
font-family: Verdana;
}
-->
</style>
<!-- InstanceEndEditable -->
</head>

<body>
<div id="accueil" style="position:absolute; left:179px; top:161px; width:115px; height:22px; z-index:1; background-image:  url(images/bouton1.jpg); layer-background-image:  url(images/bouton1.jpg); border: 1px none #000000; color: #FFFFFF; font-weight: bold;" onMouseOver="MM_showHideLayers('accueil','','hide','accueil2','','show','menuaccueil','','show','home2','','hide','menuhome','','hide','ecrans2','','hide','tv2','','hide','aide2','','hide')">
 <div align="center" class="style1 style37 style9">Accueil</div>
</div>
<div id="nouveaute" style="position:absolute; left:296px; top:161px; width:115px; height:22px; z-index:1; background-image:  url(images/bouton1.jpg); layer-background-image:  url(images/bouton1.jpg); border: 1px none #000000; color: #FFFFFF; font-weight: bold; font-family: Verdana, Arial, Helvetica, sans-serif;" onMouseOver="MM_showHideLayers('nouveaute','','hide','accueil2','','hide','menuaccueil','','hide','nouveaute2','','show','menunouv','','show','ecrans2','','hide','tv2','','hide','aide2','','hide')">
 <div align="center" class="style9">Nouveauté</div>
</div>
<div id="tv" style="position:absolute; left:530px; top:161px; width:115px; height:22px; z-index:1; background-image:  url(images/bouton1.jpg); layer-background-image:  url(images/bouton1.jpg); border: 1px none #000000; color: #FFFFFF;" onMouseOver="MM_showHideLayers('accueil2','','hide','home2','','hide','ecrans2','','hide','tv2','','show','menutv','','show','aide2','','hide')">
 <div align="center" class="style1 style37 style9"><strong>TV </strong></div>
</div>
<div id="ecransplats" style="position:absolute; left:413px; top:161px; width:115px; height:22px; z-index:1; background-image:  url(images/bouton1.jpg); layer-background-image:  url(images/bouton1.jpg); border: 1px none #000000; font-weight: bold; color: #FFFFFF; font-family: Verdana, Arial, Helvetica, sans-serif;" onMouseOver="MM_showHideLayers('accueil2','','hide','home2','','hide','ecrans2','','show','menuecrans','','show','tv2','','hide','aide2','','hide')">
 <div align="center" class="style38">Ecrans Plats </div>
</div>
<div id="aide" style="position:absolute; left:773px; top:161px; width:122px; height:22px; z-index:1; background-image:  url(images/bouton1.jpg); layer-background-image:  url(images/bouton1.jpg); border: 1px none #000000; font-family: Verdana, Arial, Helvetica, sans-serif; color: #FFFFFF; font-weight: bold;" onMouseOver="MM_showHideLayers('aide2','','show','menuaide','','show')">
 <div align="center" class="style37 style9">Guide d'achat </div>
</div>
<div id="accueil2" style="position:absolute; left:179px; top:161px; width:115px; height:22px; z-index:1; font-family: Verdana, Arial, Helvetica, sans-serif; font-weight: bold; background-color: #AAD5FF; layer-background-color: #AAD5FF; border: 1px none #000000; visibility: hidden;" onMouseOut="MM_showHideLayers('accueil','','show','home','','show','tv','','show','ecransplats','','show','aide','','show','accueil2','','hide','menuaccueil','','hide')">
 <div align="center" class="style38">
   <div id="menuaccueil" style="position:absolute; left:0px; top:22px; width:141px; height:73px; z-index:1; background-color: #AAD5FF; layer-background-color: #AAD5FF; border: 1px none #000000; visibility: hidden;" onMouseOver="MM_showHideLayers('accueil','','hide','accueil2','','show','menuaccueil','','show')" onMouseOut="MM_showHideLayers('accueil','','show','accueil2','','hide','menuaccueil','','hide')">
     <div align="left"></div>
     <div align="left"> </div>
     <div align="left">
       <p align="left"> <br>
   <span class="style40"> <a href="actualite.php">Actualité </a><br>
    <a href="promotion.php">Promotions</a></span> </p>
     </div>
   </div>
 Accueil</div>
</div>
<div id="nouveaute2" style="position:absolute; left:296px; top:161px; width:115px; height:22px; z-index:1; font-family: Verdana, Arial, Helvetica, sans-serif; font-weight: bold; background-color: #C1C1E1; layer-background-color: #C1C1E1; border: 1px none #000000; visibility: hidden;" onMouseOut="MM_showHideLayers('accueil','','show','nouveaute','','show','tv','','show','ecransplats','','show','aide','','show','nouveaute2','','hide','menunouv','','hide')">
 <div align="center">
   <div id="menunouv" style="position:absolute; left:0px; top:22px; width:141px; height:95px; z-index:1; background-color: #C1C1E1; layer-background-color: #C1C1E1; border: 1px none #000000; visibility: hidden;" onMouseOver="MM_showHideLayers('accueil','','inherit','nouveaute','','hide','nouveaute2','','show','menunouv','','show')" onMouseOut="MM_showHideLayers('accueil','','show','nouveaute2','','hide','menunouv','','hide')">
     <div align="left"><span class="style3"> <br>
        </span><span class="style33">  TV<br>
    Home Ciné<br>
    Ecran TFT<br>
    Autre </span></div>
   </div>
   <span class="style38">Nouveauté</span></div>
</div>
<div id="ecrans2" style="position:absolute; left:413px; top:161px; width:115px; height:22px; z-index:1; font-weight: bold; font-family: Verdana, Arial, Helvetica, sans-serif; background-color: #E6CCFF; layer-background-color: #E6CCFF; border: 1px none #000000; visibility: hidden;" onMouseOut="MM_showHideLayers('accueil','','show','home','','show','tv','','show','ecransplats','','show','aide','','show','ecrans2','','hide','menuecrans','','hide')">
 <div align="center">
   <div id="menuecrans" style="position:absolute; left:0px; top:22px; width:141px; height:137px; z-index:1; background-color: #E6CCFF; layer-background-color: #E6CCFF; border: 1px none #000000; visibility: hidden;" onMouseOver="MM_showHideLayers('ecrans2','','show','menuecrans','','show')" onMouseOut="MM_showHideLayers('ecransplats','','show','ecrans2','','hide','menuecrans','','hide')">
     <div align="left"> <br>
  <span class="style30"> <span class="style33"><a href="ecran_TFT15.php">15"</a><br>
 <a href="ecran_TFT17.php">   17"</a><br>
    19"<br>
    20"<br>
    21"<br>
    22"</span></span> </div>
   </div>
   <span class="style38">Ecrans Plats</span> </div>
</div>
<div id="tv2" style="position:absolute; left:530px; top:161px; width:115px; height:22px; z-index:1; background-color: #FFDFBF; layer-background-color: #FFDFBF; border: 1px none #000000; visibility: hidden;" onMouseOut="MM_showHideLayers('accueil','','show','nouveaute','','show','tv','','show','ecransplats','','show','aide','','show','tv2','','hide','menutv','','hide','homecinema','','show')">
 <div align="center" class="style1">
   <div id="menutv" style="position:absolute; left:0px; top:22px; width:141px; height:119px; z-index:1; background-color: #FFDFBF; layer-background-color: #FFDFBF; border: 1px none #000000; font-size: 14px; font-family: Verdana, Arial, Helvetica, sans-serif; visibility: hidden;" onClick="MM_showHideLayers('tv','','show','tv2','','hide','menutv','','hide')" onMouseOver="MM_showHideLayers('tv2','','show','menutv','','show')">
     <div align="left">        <br>        
       <a href="tv_plasma.php"> <span class="style25"> Téléviseur Plasma </span></a><span class="style25"><br>
         Téléviseur LCD<br>  
         TéléviseurTNT<br>
         Adaptateur TNT<br>
       Transmetteur </span></div>
   </div>
   <span class="style38"><strong>TV</strong></span></div>
</div>
<div id="aide2" style="position:absolute; left:773px; top:161px; width:122px; height:22px; z-index:1; background-color: #FFFFD2; layer-background-color: #FFFFD2; border: 1px none #000000; visibility: hidden;" onMouseOut="MM_showHideLayers('accueil','','show','nouveaute','','show','tv','','show','ecransplats','','show','aide','','show','accueil2','','hide','aide2','','hide','menuaide','','hide','homecinema','','show')">
 <div align="center" class="style1">
   <div id="menuaide" style="position:absolute; left:0px; top:22px; width:150px; height:85px; z-index:1; background-color: #FFFFD2; layer-background-color: #FFFFD2; border: 1px none #000000; visibility: hidden;" onMouseOver="MM_showHideLayers('aide','','hide','aide2','','show','menuaide','','show')" onMouseOut="MM_showHideLayers('aide','','show','aide2','','hide','menuaide','','hide')">
     <div align="left"><br>
  <span class="style33">Voir la commande<br>
  Commander<br>
  Bon (PDF) </span></div>
   </div>
   <span class="style34 style9">Guide</span> <span class="style34 style9">d'achat</span> </div>
</div>
<div id="home2" style="position:absolute; left:647px; top:161px; width:124px; height:22px; z-index:1; background-color: #FFCEB7; layer-background-color: #FFCEB7; border: 1px none #000000; visibility: hidden;" onMouseOut="MM_showHideLayers('home2','','hide','menuhome','','hide','home','','show')">
 <div align="center" class="style28 style35">
   <div id="menuhome" style="position:absolute; left:0px; top:22px; width:150px; height:68px; z-index:1; background-color: #FFCEB7; layer-background-color: #FFCEB7; border: 1px none #000000; font-size: 14px; font-weight: bold; visibility: hidden;" onMouseOver="MM_showHideLayers('home2','','show','menuhome','','show','home','','hide')" onMouseOut="MM_showHideLayers('home2','','hide','menuhome','','hide','home','','show')">      
     <div align="left" class="style36"><br>
       <span class="style25">   <a href="home_cine.php">Home Cinéma</a><br>
          Amplificateurs<br>
       Lecteurs DVD/Divx</span><br>
     </div>
   </div>
   <span class="style38"><strong>Home Cinéma </strong></span></div>
</div>

<div id="home" style="position:absolute; left:646px; top:161px; width:125px; height:22px; z-index:1; background-image: url(images/bouton1.jpg); layer-background-image: url(images/bouton1.jpg); border: 1px none #000000; font-weight: bold; font-family: Verdana; color: #FFFFFF; font-size: 14px;" onMouseOver="MM_showHideLayers('home2','','show','menuhome','','show','home','','hide')">
 <div align="center">Home Cinéma </div>
</div>
<table width="981" border="0" cellpadding="0" cellspacing="0">
 <!--DWLayoutTable-->
 <tr>
   <!-- InstanceBeginEditable name="banniere" -->
   <td height="98" colspan="5" valign="top">
     <img src="images/logo.jpg" width="265" height="109">
     <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="500" height="109">
       <param name="movie" value="destock3.swf">
       <param name=quality value=high>
       <embed src="destock3.swf" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="500" height="109"></embed>
   </object></td>
   <!-- InstanceEndEditable --></tr>
 <tr>
   <td width="158" height="84"> </td>
   <td width="23"> </td>
   <td width="585"> </td>
   <td width="4"> </td>
   <td width="211"> </td>
 </tr>
 <tr>
   <td height="61"> </td>
   <td> </td>
   <td> </td>
   <td> </td>
   <td> </td>
 </tr>
 <tr>
   <td rowspan="2" valign="top"><!--DWLayoutEmptyCell--> </td>
   <td height="190"> </td>
   <!-- InstanceBeginEditable name="contenu" -->
   <td valign="top">      <span class="style37 style9 style30">  Home Cinéma</span> > <span class="style42">Home Cinéma<br>
      </span>
     <br>      
     <table width="547" height="244" border="1" cellspacing="0" bordercolor="#FFCEB7">
       <tr>
         <td width="129" height="21" bgcolor="#FFCEB7"><div align="center" class="style9 style37"><strong>Photo</strong></div></td>
         <td width="131" bgcolor="#FFCEB7"><div align="center" class="style9 style37"><strong>M<strong>arque</strong></strong></div></td>
         <td width="149" bgcolor="#FFCEB7" class="style41"><div align="center" class="style9 style37">Descriptif</div></td>
         <td width="120" bgcolor="#FFCEB7" class="style41"><div align="center" class="style9 style37">Prix</div></td>
       </tr>
       <?php do { ?>
       <tr>
         <td class="style41"><div align="center"><br>
             <br>
             <br>
             <br>            
             <a href="images/<?php echo $row_ttleshome['photo']; ?>" target="_blank"><img src="images/<?php echo $row_ttleshome['photo']; ?>" width="124" height="141" border="0"></a><br>
             <br>            
         </div></td>
         <td class="style41"><div align="center"><?php echo $row_ttleshome['marque']; ?></div></td>
         <td class="style41"><div align="center"><?php echo $row_ttleshome['descriptif']; ?></div></td>
         <td class="style41"><div align="center">
           <p><?php echo $row_ttleshome['prix']; ?></p>
           <form name="form1" method="post" action="contenu_caddie.php">
             <input name="ajoutez au caddie" type="submit" id="ajoutez au caddie" value="caddie">
           </form>
           <p> </p>
         </div></td>
       </tr>
       <?php } while ($row_ttleshome = mysql_fetch_assoc($ttleshome)); ?>
     </table>
   <br></td>
   <!-- InstanceEndEditable -->
   <td> </td>
   <td> </td>
 </tr>
 <tr>
   <td height="95"> </td>
   <td> </td>
   <td> </td>
   <td> </td>
 </tr>
 <tr>
   <td height="267"> </td>
   <td> </td>
   <td> </td>
   <td> </td>
   <td> </td>
 </tr>
</table>
</body>
<!-- InstanceEnd --></html>
<?php
mysql_free_result($ttlesecrans);

mysql_free_result($ttleshome);
?>

Lien vers le commentaire
Partager sur d’autres sites

Bonjour,

allo y  a quelqu'un? :unsure:

<{POST_SNAPBACK}>

Entre nous : regarde ton post ! Tu as brutalement fait un copier-coller de tout ton code généré par Dreamweaver (donc illisible par définition) et tu voudrais trouver quelqu'un à MINUIT pour relire tout ca ?????

Par ailleurs, je te signale que tu as DEJA débuté un post sur une question similaire, et enfin qu'un post a été supprimé recemment pour cause de redondance.

Bref... :nono:

Pour répondre à ta question :

- D'une part, arrète tout de suite Dreamweaver, prend un éditeur de texte et commence par ecrire

$HTTP_POST_VARS['toto']

au lieu de

$http_POST_VARS['toto']

- Essaye de comprendre le principe du PHP (langage SERVEUR)

Lien vers le commentaire
Partager sur d’autres sites

Veuillez vous connecter pour commenter

Vous pourrez laisser un commentaire après vous êtes connecté.



Connectez-vous maintenant
×
×
  • Créer...