dans le cadre d'un cursus de formation php mysql, je fais un petit TP agence de voyage
J'ai une boucle, qui construit les box destinations dans la page "accueil.php". Voir images ci dessous.
l'objectif c'est quand on clic sur une des box ça nous renvoie vers une page précisant les caractéristiques de la destination.
voici la fonction qui génère la box
Code : Tout sélectionner
function generateBox($paramDestination = false) {
$html = "";
if ($paramDestination && is_array($paramDestination)) {
// cette partie génère le formulaire qui permettra de transmettre le tableau $paramDestination à la page details.php.
// on évite ainsi de refaire la requête SQL ds la page details.php
$html = '<div class="box"><form name="transfertArray" method="post" action="test.php">'
.'<input type="hidden" name="stringParamDestination" value="'. urlencode(serialize($paramDestination)).'" />'
.'<a href="#" onclick="document.forms[\'transfertArray\'].submit();" '.'>';
if (isset($paramDestination['img'])) {
$pathImg = getPathImg($paramDestination['img']);
if ($pathImg) {
$html.='<img src="' . $pathImg . '" />';
}
}
$html.=generateTitlePrice($paramDestination);
$html.='</a></form></div>';
}
return $html;
}dans ma page test.php (action du formulaire, j'ai juste mis les 2 lignes suivantes:
Code : Tout sélectionner
$destination = unserialize(urldecode($_POST['stringParamDestination']));
echo $destination['img'];"marrakech.jpg"
Je ne vois pas d'où peut venir le pb.
Si quelqu'un a une idée...
merci d'avance.

