PHP Build a Basic PHP Website Listing and Sorting Inventory Items Displaying Item Details

The details dont next to the picture they load a bit lower than they do for Alena?

include("inc/data.php");
include("inc/functions.php");

if (isset($_GET["id"])) {
    $id = $_GET["id"];
    if (isset($catalog[$id]));{
      $item = $catalog[$id];
    }
}
if (!isset($item)){
  header("location:catalog.php");
  exit;
}

$pageTitle = $item["title"];
$section = null;

include("inc/header.php"); ?>
<div class="section page">

  <div class="wrapper">

   <div class="media_picture">
    <span>
    <img src="<?php echo $item ["img"]; ?>" alt="<?php echo $item ["title"]; ?>" />
    </span>

   </div>

   <div class="media-details">

     <h1><?php echo $item["title"]; ?></h1>
     <table>

       <tr>
         <th>Category</th>
         <td><?php echo $item["category"]; ?></td>
       </tr>
       <tr>
         <th>Genre</th>
         <td><?php echo $item["genre"]; ?></td>
       </tr>
       <tr>
         <th>Format</th>
         <td><?php echo $item["format"]; ?></td>
       </tr>
       <tr>
         <th>Year</th>
         <td><?php echo $item["year"]; ?></td>
       </tr>
       <?php if(strtolower($item["category"]) == "books"){ ?>
        <tr>
         <th>Author</th>
         <td><?php echo implode(", ",$item["authors"]); ?></td>
       </tr>
       <tr>
       <tr>
         <th>Publisher</th>
         <td><?php echo $item["publisher"]; ?></td>
       </tr>
       <tr>
       <tr>
         <th>ISBN</th>
         <td><?php echo $item["isbn"]; ?></td>
       </tr>
       <tr>
       <?php } ?>  
       <?php if(strtolower($item["category"]) == "movies"){?>
       <tr>
         <th>Director</th>
         <td><?php echo $item["director"]; ?></td>
       </tr>         
       <tr>
         <th>Writers</th>
         <td><?php echo implode(", ",$item["writers"]); ?></td>
       </tr>         
       <tr>
         <th>Stars</th>
         <td><?php echo implode(", ",$item["stars"]); ?></td>
       </tr>
       <?php } ?>
       <?php if(strtolower($item["category"]) == "music"){?>
       <tr>
         <th>Artist</th>
         <td><?php echo $item["artist"]; ?></td>
       </tr> 
       <?php } ?>
     </table>

   </div>

  </div>

</div>```

i didnt copy the opening php tags on the begining but i have them on my code sorry

1 Answer

Nevermind i saw i the error on the class

Spenser Hale
Spenser Hale
18,327 Points

Hey Demian,

It would be helpful you selected your answer as best answer so the rest of the community knows your question has been solved.

Thanks