John,
I don't think I'm understanding what you are saying. Anyhow, I actually got the html
to display.
John & Mailing list,
I am having a problem with my query working. It was working, then I must have edited
something in it. I don't remember exactly what because it was very late at night.
This is what I have for the code page:
<html>
<head>
<title>www.webaddress.com</title>
<meta http-equiv="Expires" content="0">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Cache-Control" content="no-cache">
</head>
<body BACKGROUND="images/dirt.gif" text="#FFFFFF" link="#FFFFFF" vlink="#FFFF00"
alink="#FFFF00" BGPROPERTIES="fixed">
<?
if (strtoupper($REQUEST_METHOD) == "POST")
{
/* MySQL details */
$dbHost = "mysql";
$dbUser = "username";
$dbPass = "password";
$dbName = "databasename";
$table = "havedirt";
/* Attempt connection to MySQL server */
$link = @mysql_connect($dbHost, $dbUser, $dbPass);
/* If connection wasn't successful... */
if (!$link)
{
print ("<b>Error:</b> Could not connect to database.");
exit;
}
/* Attempt to select our database */
if ([EMAIL PROTECTED]($dbName))
{
print("<b>Error:</b> Could not find $dbName database.");
exit;
}
/*Build SQL query to insert havedirt information into table*/
$DirtType = $_POST["havedirtype"];
$Yards = $_POST["noyards"];
$Contact = $_POST["contactname"];
$Area = $_POST["areacode"];
$Prefix = $_POST["prefix"];
$Suffix = $_POST["suffix"];
$Zip = $_POST["zipcode"];
$D_Month = $_POST["date_month"];
$D_Day = $_POST["date_day"];
$D_Year = $_POST["date_year"];
$Email = $_POST["email"];
$Jcity = $_POST["jobcity"];
$XStreets = $_POST["xstreets"];
$query = "INSERT INTO $table (havedirtype, noyards, contactname, areacode, prefix,
suffix, zipcode, date_month, date_day, date_year, email, jobcity, xstreets) VALUES
'$DirtType','$Yards','$Contact','$Area','$Prefix','$Suffix','$Zip','$D_Month','$D_Day','$D_Year','$Email','$Jcity','$XStreets'";
/* Execute query */
$result = mysql_query($query);
/* If there was a problem with the query... */
if (!$result || @mysql_num_rows($result) < 1)
{
print("Error: Could not insert listing into database.");
}
else
{
print ("<h3>YOUR LISTING HAS BEEN SUBMITTED</h3><br>");
}
/*Close link to MySQL*/
mysql_close($link);
}
else
{
print ("<h3>YOU MUST FIRST ENTER A LISTING</h3><br>");
}
?>
</body>
</html>
And this is the source that comes back:
<html>
<head>
<title>www.webaddress.com</title>
<meta http-equiv="Expires" content="0">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Cache-Control" content="no-cache">
</head>
<body BACKGROUND="images/dirt.gif" text="#FFFFFF" link="#FFFFFF" vlink="#FFFF00"
alink="#FFFF00" BGPROPERTIES="fixed">
Error: Could not insert listing into database.
</body>
</html>