|
Hey guys, I thought i would introduce myself with a little code analysis help.
When I access this page via IE, Opera, FireFox, etc... I receive a blank HTML page. I verifide server side programs (PHP, MySQL) settings and make sure the MySQL statements where proper. Anyways this is just a beginner program i'm writing for educational purposes.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> Input and submit favorites to firstdb </TITLE>
</HEAD>
<BODY>
<?php
require("openfirstdb.php");
if (@($submitted)) {
$title = addslashes(trim($title));
$description= addslashes(trim($description));
$valuesx = " VALUES ('0', '" . $title . "', '" . $description . "')";
$query="INSERT INTO favorites " . $valuesx;
print("Insert query is: " . $query);
$result = mysql_db_query($DBname, $query, $link);
if ($result) {
print("The favorite was successfully added.<br>\n");
}
else {
print("The favorite was NOT successfully added. <br>\n");
}
$submitted = FALSE;
mysql_close($link);
print("<a href=\"saddfavoriter.php\">Submit another favorite </a><br>");
} //ends if submitted
else {
?>
<h1>Add a title to the databank of favorite shows. <br></h1>
<?
$sq = "SELECT * FROM favorites";
print("<h3>Favorites</h3><br>");
$rs = mysql_db_query($DBname, $sq, $link);
print("<table><tr><td> Titles</td><td>Description</td></tr> ");
print("\n");
while ($row=mysql_fetch_array($rs)) {
print("\n");
print("<tr><td>");
print($row["title"]);
print("</td><td>");
print($row["description"]);
print("</td></tr>");
} //end while
print("</table>");
?>
<form action="saddfavoriter.php" method="POST"><br>
Title of show <input type=text name="title" size=50> <br>
Description <input type=text name="description" size=50> <br>
<input type=hidden name="submitted" value="True"><br>
<input type=submit name="submit" value="Submit favorite!"><br>
</form>
<?
} //ends else clause for submitting form
?>
</BODY>
</HTML>
Thanks,
--Curtis
|