When I try to compile the following code
<?php # Script 13.7 - view_print.php
// This page displays the details for a particular print.
if (is_numeric ($_GET['pid'])) { // Make sure there's a print ID.
require_once ('./mysql_connect.php'); // Connect to the database.
$query = "SELECT * FROM artists, prints WHERE artists.artist_id = prints.artist_id AND prints.pid = {$_GET['pid']}";
$result = mysql_query ($query);
$row = mysql_fetch_array ($result, MYSQL_ASSOC);
mysql_close(); // Close the database connection.
// Set the page title and include the HTML header.
$page_title = $row['print_name'];
include_once ('includes/header.html');
// Display a header.
echo "<div align=\"center\">
<b>{$row['print_name']}</b> by
{$row['first_name']} {$row['middle_name']} {$row['last_name']}
<br />{$row['size']}
<br />${$row['price']}
<a href=\"add_cart.php?pid={$row['pid']}\">Add to Cart</a>
</div><br />";
// Get the image information and display the image.
if ($image = @getimagesize("uploads/{$row['image_name']}")) {
echo "<div align=\"center\"><img src=\"uploads/{$row['image_name']}\" $image[3] alt=\"{$row['print_name']}\" />";
} else {
echo "<div align=\"center\">No image available.";
}
echo '<br />' . stripslashes($row['description']) . '</div>';
include_once('includes/footer.html'); // Require the HTML footer.
} else { // Redirect
header ("Location: [url]http://[/url]" . $SERVER['HTTP_HOST'] . dirname($SERVER['PHP_SELF']) . "/index.php");
exit();
}
?>
it appear this problem.
Notice: Undefined index: pid in C:\Program Files\Apache Group\Apache2\htdocs\view_print.php on line 4
Warning: Cannot modify header information - headers already sent by (output started at C:\Program Files\Apache Group\Apache2\htdocs\view_print.php:4) in C:\Program Files\Apache Group\Apache2\htdocs\view_print.php on line 36
Can u help me to solve these problem?