Version complète: sur le forum Webmaster Hub : recuperation de variables
Webmaster Hub > Création et exploitation de Sites Internet > Les langages du Net > PHP
nolog
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:
-----------------------------------------------------------------------------------------------------
CODE
<?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 :

CODE
<?php
 
session_start();
 
echo 'photo:',$http_SESSION_VARS['photo'],'<br/>
        Marque:',$http_SESSION_VARS['marque'],'<br/>
        Prix:',$http_SESSION_VARS['prix'],'<br/>';
?>
hcplayer
CODE
<?
session_start()
$_SESSION['photo'] = $row_ttleshome['marque'];
$_SESSION['marque']=$row_ttleshome['marque'];
$_SESSION['desciptif']=$row_ttleshome['marque'];
?>

---------------------------------------------------------------------------------------------------
dans la page 2 :

CODE
<?
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 wink.gif
nolog
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)

CODE

<?
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&eacute;</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">&nbsp;<br>
&nbsp;&nbsp;&nbsp;<span class="style40">&nbsp;<a href="actualite.php">Actualit&eacute; </a><br>
&nbsp;&nbsp;&nbsp; <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>
      &nbsp;&nbsp;</span><span class="style33">&nbsp; TV<br>
&nbsp;&nbsp;&nbsp; Home Cin&eacute;<br>
&nbsp;&nbsp;&nbsp;&nbsp;Ecran TFT<br>
&nbsp;&nbsp;&nbsp; Autre </span></div>
   </div>
   <span class="style38">Nouveaut&eacute;</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>
&nbsp;&nbsp;<span class="style30">&nbsp;<span class="style33"><a href="ecran_TFT15.php">15&quot;</a><br>
&nbsp;<a href="ecran_TFT17.php">&nbsp;&nbsp; 17&quot;</a><br>
&nbsp;&nbsp;&nbsp; 19&quot;<br>
&nbsp;&nbsp;&nbsp; 20&quot;<br>
&nbsp;&nbsp;&nbsp; 21&quot;<br>
&nbsp;&nbsp;&nbsp; 22&quot;</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">&nbsp;<span class="style25"> T&eacute;l&eacute;viseur Plasma </span></a><span class="style25"><br>
       &nbsp; T&eacute;l&eacute;viseur LCD<br>  
       &nbsp; T&eacute;l&eacute;viseurTNT<br>
       &nbsp; Adaptateur TNT<br>
     &nbsp; 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>
&nbsp; <span class="style33">Voir la commande<br>
&nbsp; Commander<br>
&nbsp; 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"> &nbsp; <a href="home_cine.php">Home Cin&eacute;ma</a><br>
        &nbsp; Amplificateurs<br>
     &nbsp; Lecteurs DVD/Divx</span><br>
     </div>
   </div>
   <span class="style38"><strong>Home Cin&eacute;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&eacute;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">&nbsp;</td>
   <td width="23">&nbsp;</td>
   <td width="585">&nbsp;</td>
   <td width="4">&nbsp;</td>
   <td width="211">&nbsp;</td>
 </tr>
 <tr>
   <td height="61">&nbsp;</td>
   <td>&nbsp;</td>
   <td>&nbsp;</td>
   <td>&nbsp;</td>
   <td>&nbsp;</td>
 </tr>
 <tr>
   <td rowspan="2" valign="top"><!--DWLayoutEmptyCell-->&nbsp;</td>
   <td height="190">&nbsp;</td>
   <!-- InstanceBeginEditable name="contenu" -->
   <td valign="top">      <span class="style37 style9 style30">&nbsp; Home Cin&eacute;ma</span> &gt; <span class="style42">Home Cin&eacute;ma<br>
     &nbsp;</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>&nbsp;</p>
         </div></td>
       </tr>
       <?php } while ($row_ttleshome = mysql_fetch_assoc($ttleshome)); ?>
     </table>
   <br></td>
   <!-- InstanceEndEditable -->
   <td>&nbsp;</td>
   <td>&nbsp;</td>
 </tr>
 <tr>
   <td height="95">&nbsp;</td>
   <td>&nbsp;</td>
   <td>&nbsp;</td>
   <td>&nbsp;</td>
 </tr>
 <tr>
   <td height="267">&nbsp;</td>
   <td>&nbsp;</td>
   <td>&nbsp;</td>
   <td>&nbsp;</td>
   <td>&nbsp;</td>
 </tr>
</table>
</body>
<!-- InstanceEnd --></html>
<?php
mysql_free_result($ttlesecrans);

mysql_free_result($ttleshome);
?>

nolog
allo y a quelqu'un? unsure.gif
NorSeb
Bonjour,

CITATION(nolog @ jeudi 22 décembre 2005, 23h35)
allo y  a quelqu'un? unsure.gif
*


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
CODE
$HTTP_POST_VARS['toto']

au lieu de
CODE
$http_POST_VARS['toto']


- Essaye de comprendre le principe du PHP (langage SERVEUR)
nolog
je crois que t as raison!!
hcplayer
met plutot les 2 pages, (mais juste les parties intéressantes biggrin.gif
Ceci est une version "bas débit" de notre forum. Pour voir la version complète avec plus d'information, la mise en page et les images, veuillez cliquer ici.