Ok, so I am trying to figure out why this will not updating on my website, but will on my computer, here is a copy of my code…
My CSS file:
body { background-color: #CCCCCC; color: #000000; font-family: Arial, Verdana, sans-serif; margin: 0;}
h1 { text-align: center; font-weight: bold; }
p2 { font-size: 100%; }
.content { padding: 10px 10px 0 10px; }
.footer { position: absolute; bottom: 5px; left: 400px; font-style: italic; font-size: 75%; text-align: center; }
.new { font-weight: bold; font-style: italic; }
#box { background-color: #999999; width: 100%; min-width: 800px; padding-left: 10px; }
#center { margin-left: 100px; background-color: #CCCCCC; }
#left { float: left; width: 100px; background-color: #999999; border: none; font-size: 100%; font-weight: bold; }
#left a { text-decoration: none; color: #000000; margin: 15px; display: block; }
#left a:visited { color: #000000; }
#left a:hover { color: #000000; background-color: #CCCCCC; }
#logo { background-color: #999999; font-weight: bold; text-align: center; font-size: 80px; }
#right { float: right; width: 200px; background-color: #999999; border: none; padding-left: 10px; }
My main page:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!-- Open HTML -->
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!-- Open HEAD -->
<head>
<title>List of Comics</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<link href="../tapp.css" rel="stylesheet" type="text/css" />
</head>
<!-- Close HEAD -->
<!-- Open BODY-->
<body>
<!-- Open BOX -->
<div id="box">
<!-- Open LOGO -->
<div id="logo">Robs Internet Comic Database</div>
<!-- Close LOGO -->
<!-- Open LEFT -->
<div id="left">
<p><a href="?addcomic">Add Comic</a></p>
<p><a href="?addauthor">Add Author</a></p>
</div>
<!-- Close LEFT -->
<br />
<!-- Open Right -->
<div id="right">
</div>
<!-- Close Right -->
<!-- Open Center -->
<div id="center">
<div class="content">
<p>Here is a list of Author's and ID's</p>
<!-- Create Table for Author List -->
<table border="1" cellpadding="2">
<tr>
<th>Author</th>
<th>Id</th>
<th>Remove</th>
</tr>
<!-- Call PHP containing Author INFO -->
<?php foreach ($Comic as $Splat): ?>
<form action="?deleteauthor" method="post">
<tr>
<td><?php echo htmlspecialchars($Splat['ComicAuthor'], ENT_QUOTES,
'UTF-8'); ?></td>
<td><?php echo htmlspecialchars($Splat['ID'], ENT_QUOTES,
'UTF-8'); ?></td>
<td><input type="hidden" name="ID" value="
<?php echo $Splat['ID']; ?>"/>
<input type="submit" value="Delete"/> </td>
</tr>
<?php endforeach; ?>
<!-- Close PHP containing Author INFO -->
</table>
<!-- Close Table for Author List -->
<p>Here are all the comics in the database:</p>
<!-- Create Table for Comic List -->
<table border="1" cellpadding="2">
<tr>
<th>Number</th>
<th>Name</th>
<th>Title</th>
<th>Date</th>
<th>Author</th>
<th>Remove</th>
</tr>
<!-- Call PHP containing Comic INFO -->
<?php foreach ($Comics as $Gizmo): ?>
<form action="?deletecomic" method="post">
<tr>
<td><?php echo htmlspecialchars($Gizmo['ComicNumber'], ENT_QUOTES,
'UTF-8'); ?></td>
<td><?php echo htmlspecialchars($Gizmo['ComicName'], ENT_QUOTES,
'UTF-8'); ?></td>
<td><?php echo htmlspecialchars($Gizmo['ComicTitle'], ENT_QUOTES,
'UTF-8'); ?></td>
<td><?php echo htmlspecialchars($Gizmo['ComicDate'], ENT_QUOTES,
'UTF-8'); ?></td>
<td><?php echo htmlspecialchars($Gizmo['ComicAuthor'], ENT_QUOTES,
'UTF-8'); ?></td>
<td><input type="hidden" name="id" value="
<?php echo $Gizmo['id']; ?>"/>
<input type="submit" value="Delete"/> </td>
</tr>
</form>
<!-- Close PHP containing Comic INFO -->
<?php endforeach; ?>
</table>
<!-- Close Table for Comic List --></div>
<!-- Close Content -->
<!-- Open Footer -->
<div class="footer">Questions? <a href=mailto:admin">Email Webmaster!</a><br />
Last Update 05/03/2011<br />
©2011 Another Tappiocca Production
</div>
<!-- Close Footer -->
</div>
<!-- Close BOX -->
</div>
<!-- Close Center -->
</body>
<!-- Close BODY-->
</html>
<!-- Close HTML -->
The page to add info:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Add Author</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<!-- Create Internal CSS -->
<style type="text/css">
textarea { display: block; width: 10%; }
</style>
<!-- Close Internal CSS -->
<!-- Call External CSS -->
<link href="../tapp.css" rel="stylesheet" type="text/css" />
</head>
<!-- Open Body -->
<body>
<!-- Open Box -->
<div id="box">
<!-- Open Logo -->
<div id="logo">Rob's Internet Comic Database</div>
<!-- Close Logo -->
<!-- Open Left/internal links -->
<div id="left">
<a href="../index.html">Home</a>
<a href="index.php">Database</a>
<!-- Create add comic/author link -->
<p><a href="?addauthor">Add Author</a></p>
<p><a href="?addcomic">Add Comic</a></p>
</div>
<!-- Close Left/internal links -->
<br />
<!-- Open Right/News Feed -->
<div id="right">
</div>
<!-- Close Right/News Feed -->
<!-- Open Center -->
<div id="center">
<!-- Open Content -->
<div class="content">
<!-- Call PHP form to create ID/Author -->
<form action="?" method="post">
<div>
<!-- Create Author ID -->
<label for="ID">Author ID:</label>
<textarea id="ID" name="ID" rows="1" cols="10"></textarea>
<!-- Create Author Name -->
<label for="ComicAuthor">Author Name:</label>
<textarea id="ComicAuthor" name="ComicAuthor" rows="1" cols="10"></textarea>
</div>
<div><input type="submit" value="Add"/></div>
</form>
<!-- Close PHP form to create ID/Author -->
</div>
<!-- Close Content -->
<!-- Open Footer -->
<div class="footer">Questions? <a href="mailto:admin"> Email Webmaster!</a> <br />
Last Update 05/03/2011<br />
©2011 Another Tappiocca Production
</div>
<!-- Close Footer -->
</div>
<!-- Close Center -->
</div>
<!-- Close Box -->
</body>
<!-- Close Body -->
</html>
<!-- Close HTML -->
and the PHP itself:
<?php
if (get_magic_quotes_gpc())
{
function stripslashes_deep($value)
{
$value = is_array($value) ?
array_map('stripslashes_deep', $value) :
stripslashes($value);
return $value;
}
$_POST = array_map('stripslashes_deep', $_POST);
$_GET = array_map('stripslashes_deep', $_GET);
$_COOKIE = array_map('stripslashes_deep', $_COOKIE);
$_REQUEST = array_map('stripslashes_deep', $_REQUEST);
}
if (isset($_GET['addcomic']))
{
include 'form.html.php';
exit();
}
if (isset($_GET['addauthor']))
{
include 'form2.html.php';
exit();
}
$link = mysqli_connect('localhost', 'root', 'root');
if (!$link)
{
$error = 'Unable to connect to the database server: '. mysqli_error($link);
include 'error.html.php';
exit();
}
if (!mysqli_set_charset($link, 'utf8'))
{
$output = 'Unable to set database connection encoding: '. mysqli_error($link);
include 'output.html.php';
exit();
}
if (!mysqli_select_db($link, 'icdb'))
{
$error = 'Unable to locate the comic database: '. mysqli_error($link);
include 'error.html.php';
exit();
}
if (isset($_POST['ComicNumber']))
{
foreach ($_POST as $key => $val)
{
$_POST[$key] = mysqli_real_escape_string($link, $_POST[$key]);
}
$ComicNumber = $_POST['ComicNumber'];
$ComicName = $_POST['ComicName'];
$ComicTitle = $_POST['ComicTitle'];
$ComicDate = $_POST['ComicDate'];
$AuthorId = $_POST['AuthorId'];
$sql = "INSERT INTO `Comics` (`ComicNumber`, `ComicName`, `ComicTitle`, `ComicDate`, `AuthorId`)
VALUES ($ComicNumber, '$ComicName', '$ComicTitle', '$ComicDate', $AuthorId)";
if (!mysqli_query($link, $sql))
{
$error = 'Error adding submitted Comic: ' . mysqli_error($link);
include 'error.html.php';
exit();
}
header('Location: .');
exit();
}
if (isset($_POST['ComicAuthor']))
{
foreach ($_POST as $key => $val)
{
$_POST[$key] = mysqli_real_escape_string($link, $_POST[$key]);
}
$ID = $_POST['ID'];
$ComicAuthor = $_POST['ComicAuthor'];
$sql = "INSERT INTO `ComicAuthor` (`ID`, `ComicAuthor`)
VALUES ($ID, '$ComicAuthor')";
if (!mysqli_query($link, $sql))
{
$error = 'Error adding submitted Author: ' . mysqli_error($link);
include 'error.html.php';
exit();
}
header('Location: .');
exit();
}
if (isset($_GET['deletecomic']))
{
$id = mysqli_real_escape_string($link, $_POST['id']);
$sql = "DELETE FROM Comics WHERE id='$id'";
if (!mysqli_query($link, $sql))
{
$error = 'Error deleting comic: ' . mysqli_error($link);
include 'error.html.php';
exit();
}
header('Location: .');
exit();
}
if (isset($_GET['deleteauthor']))
{
$ID = mysqli_real_escape_string($link, $_POST['ID']);
$sql = "DELETE FROM ComicAuthor WHERE ID='$ID'";
if (!mysqli_query($link, $sql))
{
$error = 'Error deleting comic author: ' . mysqli_error($link);
include 'error.html.php';
exit();
}
header('Location: .');
exit();
}
$result = mysqli_query($link,
'SELECT Comics.id, ComicNumber, ComicName, ComicTitle, ComicDate, ComicAuthor FROM Comics INNER JOIN ComicAuthor ON AuthorId ComicAuthor.id');
if (!$result)
{
$error = 'Error fetching Comics: ' . mysqli_error($link);
include 'error.html.php';
exit();
}
while ($row = mysqli_fetch_array($result))
{
$Comics[] = array('id' => $row['id'], 'ComicNumber' => $row['ComicNumber'],
'ComicName' => $row['ComicName'], 'ComicTitle' => $row['ComicTitle'],
'ComicDate' => $row['ComicDate'], 'ComicAuthor' => $row['ComicAuthor']);
}
$result1 = mysqli_query($link, 'SELECT ID, ComicAuthor FROM ComicAuthor');
if (!$result1)
{
$error = 'Error fetching Comics: ' . mysqli_error($link);
include 'error.html.php';
exit();
}
while ($row = mysqli_fetch_array($result1))
{
$Comic[] = array('ID' => $row['ID'], 'ComicAuthor' => $row['ComicAuthor']);
}
include 'comics.html.php';
?>