I want to add links to Title, name, and format. I was able to add links to all three but when I click on them they only open the page linked to format when I want the links for Title and name to point to separate pages. Can you tell me where my error is? Here is part of the code for index.php:
try
{
$sql = 'SELECT titles.id,
titles.Title,
directors.name,
titles.link,
directors.link,
premieres.date,
availability.format,
availabilitylinks.link
FROM titles
INNER JOIN directors
ON directorid = directors.id
INNER JOIN premieres
ON dateid = premieres.id
INNER JOIN availability
ON availabilityid = availability.id
INNER JOIN availabilitylinks
ON availabilitylinkid = availabilitylinks.id';
$result = $pdo->query($sql);
}
catch (PDOException $e)
{
$error = 'Error fetching titles: ' . $e->getMessage();
include 'error.html.php';
exit();
}
foreach ($result as $row)
{
$titles[] = array(
'id' => $row['id'],
'text' => $row['Title'],
'titles.link' => $row['link'],
'name' => $row['name'],
'directors.link' => $row['link'],
'date' => $row['date'],
'format' => $row['format'],
'availabilitylinks.link' => $row['link']
);
}
include 'films.html.php';
And here is part of films.html.php:
<?php foreach ($titles as $film): ?>
<form action="?deletefilm" method="post">
<blockquote>
<p>
<a href="<?php
echo htmlspecialchars($film['titles.link'], ENT_QUOTES,
'UTF-8'); ?>"><?php
echo htmlspecialchars($film['text'], ENT_QUOTES, 'UTF-8'); ?></a>
<input type="hidden" name="id" value="<?php echo $film['id']; ?>">
<input type="submit" value="Delete">
(by <a href="<?php
echo htmlspecialchars($film['directors.link'], ENT_QUOTES,
'UTF-8'); ?>"><?php
echo htmlspecialchars($film['name'], ENT_QUOTES,
'UTF-8'); ?></a>) Premiered <?php
echo htmlspecialchars($film['date'], ENT_QUOTES,
'UTF-8'); ?>
<a href="<?php
echo htmlspecialchars($film['availabilitylinks.link'], ENT_QUOTES,
'UTF-8'); ?>"><?php
echo htmlspecialchars($film['format'], ENT_QUOTES,
'UTF-8'); ?></a>
</p>