Page PHP / PDO ne reçoit pas les variables passées par la page précédente
Bonsoir,
Comme dit dans l'intitulé, ma page ne reçoit pas les variables de la page précédente, mais ne génère pas de message d'erreur.
Voici la page qui envoie la variable :
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
| <?php
require 'include/sqlconnect.php';
include("menu.php");
?>
<link rel="stylesheet" href="style.css" type="text/css">
<link rel="stylesheet" href="menu/dropdown_three.css" type="text/css">
<p align="left"> :: Concert</p>
<center>
<tr>
<form action="concert_ajoute.php" method="post">
<td><input type="submit" value="Ajouter un concert " /></td>
</form>
</tr>
</center>
<br />
<table class="bicolor" width="80%" align="center" border="1">
<tr>
<th>Concert</th>
<th>Lieu</th>
<th>Date</th>
<th class="intitule"> </th>
</tr>
<?php
$sth = $bdd->query("SELECT IDconcert, titreconcert, lieu, DATE_FORMAT( dateconcert, '%d/%m/%Y' ) AS dateconc FROM Concert ORDER by dateconcert DESC");
while($row = $sth->fetch(PDO::FETCH_ASSOC))
{
$id = $row['IDconcert'];
$tc = $row['titreconcert'];
$lieu = $row['lieu'];
$dateconc = $row['dateconc'];
echo "<tr>";
echo "<td>" . $row['titreconcert'] . "</td>";
echo "<td>" . $row['lieu'] . "</td>";
echo "<td>" . $row['dateconc'] . "</td>";
echo "<td>";
echo "<a href=concert_edite_pdo.php?id=$id>Editer</a>";
echo "</td>";
echo "</tr>";
}
$sth->closeCursor();
echo "</table>";
?> |
Et la page sensée la recevoir mais qui affiche seulement le numéro de l'id :
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 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
| <?php error_reporting (E_ALL ^ E_NOTICE); ?>
<?php
require 'include/sqlconnect.php';
include("menu.php");
?>
<link rel="stylesheet" href="style.css" type="text/css">
<link rel="stylesheet" href="menu/dropdown_three.css" type="text/css">
<style type="text/css">
input {width:400px;
}
td {width:134px;
font-size: medium;
}
</style>
<?php
if ($_REQUEST['action']=="maj")
{
$sth = $bdd->prepare("UPDATE Concert SET
titreconcert = '".$_REQUEST['titreconcert']."' ,
lieu = '".$_REQUEST['lieu']."',
dateconcert = '".$_REQUEST['dateconcert']."'".
"WHERE IDconcert ='".$_REQUEST['id']."'");
$sth->execute(array(':id'=>$_POST['id']));
}
elseif ($_REQUEST['action']=="suppr" && $_REQUEST['id']>=1)
{
$sth = $bdd->query("DELETE FROM Concert WHERE IDconcert ='".$_REQUEST['id']."'");
header("location: http://www.chaletmurcie.ch/pages/osg/concert_edite_pdo.php");
}
echo "<p align=left> :: Concert [".$_REQUEST['id']."]</p>";
$sth = $bdd->query("SELECT IDconcert, titreconcert, lieu, dateconcert FROM Concert WHERE IDconcert = '".$_REQUEST['id']."'");
$Concert = $sth->fetchAll();
?>
<form action="concert_edite_pdo.php" method="post">
<input type="hidden" name="enregistre" value="oui" />
<input type="hidden" name="id" value="<?php echo $_REQUEST['id']; ?>" />
<table align="center">
<tr>
<td class="mediumfont">Concert</td>
<td><input type="text" name="titreconcert" value="<?php echo $Concert['titreconcert']; ?>" /></td>
</tr>
<tr>
<td class="mediumfont">Lieu</td>
<td><input type="text" name="lieu" value="<?php echo $Concert['lieu']; ?>" /></td>
</tr>
<tr>
<td class="mediumfont">Date</td>
<td><input type="text" name="dateconcert" value="<?php echo $Concert['dateconcert']; ?>" /></td>
</tr>
</table>
<br/>
<table align="center">
<tr>
<td>
<select name="action">
<option value="maj"> Enregistrer la fiche </option>
<option value="suppr"> Supprimer la fiche </option>
</select>
</td>
<td>
<input type="submit" value="effectuer">
</td>
</tr>
</table>
</form>
<table align="center">
<tr>
<td>
<form action="admin.php" method="post">
<input type="submit" value="Terminé" />
</form>
</td>
</tr>
</table>
<?php
$sth->closeCursor();
?> |
Une fois de plus merci d'avance pour votre aide