I need Your help Ihave table that in each line there is a checkbox I want if user check any line the value stock in session and use it in other page like show it ( just test to make sure that it works )
<?php
$Police = $_SESSION['N_Police'];
$sql = 'SELECT * FROM facture WHERE Client='.$Police;
$lst = mysql_query($sql);
?>
<?php
while ($fact = mysql_fetch_array($lst))
{
?>
<?php if (strcmp(($fact['Etat']),("Payé"))) { ?>
<tr style="background:White;">
<?php } else if (strcmp(($fact['Etat']),("Non Payé"))) { ?>
<tr style="background:#FFCC77;">
<?php } ?>
<td width="5%"> <form method="post"><input Type="checkbox" name="cle['<?php echo $fact['NumFacture']; ?>']" Value="<?php echo $fact['NumFacture']; ?>"></form></td>
<td> <?php echo $fact['NumFacture']; ?> </td>
<td> <?php echo $fact['Mois'].'-'.$fact['Annee']; ?> </td>
<td> <?php echo $fact['Montant']; ?> </td>
<td> <?php echo $fact['Dernier delai']; ?> </td>
<td> <?php echo $fact['Etat']; ?> </td>
</tr>
<?php
}
mysql_free_result($lst);
mysql_close();
?>
and I use thios code to save int the same page :
<?php
if (isset($_POST)){
foreach ($_POST['cle'] as $key => $value){
$_SESSION['cle'] = $_POST["cle"];
}
}
?>
and in the other page that I want it to show I use this code :
<?php
session_start();
if (isset($_SESSION["cle"])) {
foreach ($_SESSION['cle'] as $key => $value)
echo "<b>Your games are: </b>" . $_SESSION["cle"];
}
?>
but didn t work just in informe : there is session_start in my first page also.
Aucun commentaire:
Enregistrer un commentaire