Partage
  • Partager sur Facebook
  • Partager sur Twitter

page de recherche de films en php

22 septembre 2019 à 14:14:07

Bonjour à tous.
Je ne sait pas si je pose ma question au bonne endroit et de la bonne façon.
mas je suis en formation et la j'ai un devoir qui me pose problème.
L'intitulé est :
Vous devez donc construire un site qui affiche la liste des années disponibles pour les films listés.
Quand l’utilisateur clique sur une année, les films liés sont affichés.
1. Affichez en liste les années des films listés.
2. Quand l’utilisateur sélectionne une date, la liste des films liés est affichée avec leur description.
Utilisation des listes
–– Génération de liens
–– Utilisation du Gindex.phpET
–– Utilisation des boucles FOREACH
j'ai fait le fichier qui est en pièce jointe.
Je me pose la question: est ce qu'il est possible en php de faire que la date soit directement cliquable sans avoir à passer par un bouton radio ?????
Merci à ceux qui voudrons bien m'aider.
<pre class="brush: php;"><body>
 <h1>RECHERCHE DE FILM</h1>
        <form action="index.php" method="get">
        <fieldset>
        <p>
                <label> Liste des années:<br></label>
                <br>
                    <input type="radio" name="choice" value="1992">1992<br/>
                    <input type="radio" name="choice" value="1994">1994 <br />
                    <input type="radio" name="choice" value="1995">1995 <br />
                    <input type="radio" name="choice" value="1997">1997 <br />
                    <input type="radio" name="choice" value="2016">2016 <br />
                    <input type="radio" name="choice" value="2018">2018 <br />
                <br>       
                <input type="submit">
        </p>
        </fieldset>
    </form>
</body>
</html>
<?php
$movings = array(
0 =>array('movie'=>'Impitoyable','year'=>'1992','descriptions'=>'Retired Old West gunslinger William Munny reluctantly takes on one last job, with the help of his old partner and a young man.'),

1 =>array('movie'=>'Reservoir Dogs ', 'year' => '1992','descriptions' => 'When a simple jewelry heist goes horribly wrong, the surviving criminals begin to suspect that one of them is a police informant.'),

2 =>array('movie'=>'les evadés', 'year' => '1994', 'descriptions' => 'Two imprisoned men bond over a number of years, finding solace and eventual redemption through acts of common decency.'),

3 =>array('movie'=>' Fight Club ', 'year' => '1994','descriptions' => 'An insomniac office worker and a devil-may-care soapmaker form an underground fight club that evolves into something much, much more.'),

4 =>array('movie'=>' Forrest Gump', 'year' => '1994','descriptions' => 'The presidencies of Kennedy and Johnson, the events of Vietnam, Watergate, and other history unfold through the perspective of an Alabama man with'),

5 =>array('movie'=>' Léon', 'year' => '1994','descriptions' => 'Mathilda, a 12-year-old girl, is reluctantly taken in by Léon, a professional assassin, after her family is murdered. Léon and Mathilda form an unusual relationship, as she becomes his protégée and learns the assassin'),

6 =>array('movie'=>'La haine', 'year' => '1995','descriptions' => '24 hours in the lives of three young men in the French suburbs the day after a violent riot'),

7 =>array('movie'=>'Seven', 'year' => '1995','descriptions' => 'Two detectives, a rookie and a veteran, hunt a serial killer who uses the seven deadly sins as his motives'),

8 =>array('movie'=>' Usual Suspects', 'year' => '1995','descriptions' => 'A sole survivor tells of the twisty events leading up to a horrific gun battle on a boat, which began when five criminals met at a seemingly random police lineup'),

9 =>array('movie'=>'La vie est belle ', 'year' => '1997','descriptions' => 'When an open-minded Jewish librarian and his son become victims of the Holocaust, he uses a perfect mixture of will, humor, and imagination to protect his son from the dangers around their camp'),

10 =>array('movie'=>'  Will Hunting', 'year'=>'1997','descriptions' => 'Will Hunting, a janitor at M.I.T., has a gift for mathematics, but needs help from a psychologist to find direction in his life.'),

11 =>array('movie'=>'Avengers: Infinity War', 'year'=>'2018','descriptions' => 'The Avengers and their allies must be willing to sacrifice all in an attempt to defeat the powerful Thanos before his blitz of devastation and ruin puts an end to the universe'),

12 =>array('movie'=>'Spider-Man: New Generation', 'year'=>'2018','descriptions' => 'Teen Miles Morales becomes Spider-Man of his reality, crossing his path with five counterparts from other dimensions to stop a threat for all realities'),

13 =>array('movie'=>'Capharnaum', 'year' => '2018','descriptions' => 'While serving a five-year sentence for a violent crime, a 12-year-old boy sues his parents for neglect'),

14 =>array('movie'=>'Dangal', 'year' => '2016','descriptions' => 'Former wrestler Mahavir Singh Phogat and his two wrestler daughters struggle towards glory at the Commonwealth Games in the face of societal oppression'),

15 =>array('movie'=>'Tu ne tueras point ','year' => '2016','descriptions' => 'World War II American Army Medic Desmond T. Doss, who served during the Battle of Okinawa, refuses to kill people, and becomes the first man in American history to receive the Medal of Honor without firing a shot'),

16 =>array('movie'=>'Mademoiselle', 'year' => '2016','descriptions' => 'A woman is hired as a handmaiden to a Japanese heiress, but secretly she is involved in a plot to defraud her'),

);
if (isset($_GET['choice'])) { 
    $choice = $_GET['choice'] ; 
    foreach ($movings as $select) 
    {
        if ($select['year'] == $choice) 
         {
      
echo '<pre>';          
echo 'l\'annee de votre choix est: '. $choice ;
echo '. le titre du film :'.($select['movie']);
echo '. la description :'.($select['descriptions']);
echo '</pre>';

          }
    }
}

</pre>
  • Partager sur Facebook
  • Partager sur Twitter
22 septembre 2019 à 17:13:06

Bonjour philodick.

Merci de t'on aide. Malheureusement je ne doit pas utilisé de SQL uniquement du HTML et PHP.

Merci encore.

  • Partager sur Facebook
  • Partager sur Twitter
22 septembre 2019 à 17:23:47

Bonjour, 

Une URL ne t'oblige pas à utiliser du SQL. Tu peux très bien faire un lien qui passe l'année en paramètre GET et tu affiche ta liste en fonction de ton année passée et tu fais ton traitement après l'initialisation de ton tableau.

  • Partager sur Facebook
  • Partager sur Twitter
22 septembre 2019 à 19:20:58

help cernkor tu fait ca comment ???? t'on idée m'intéresse au plus haut point.
  • Partager sur Facebook
  • Partager sur Twitter
22 septembre 2019 à 20:12:29

Je ne suis pas sûr que tu aies cherché beaucoup.

<a href="mapage.php?param=toto">Lien</a>



  • Partager sur Facebook
  • Partager sur Twitter