Kungfu_Jesus
03-31-2007, 05:42 AM
I'm having a problem getting this program to compile. I can't find where the error is, but the URL is here.
http://allamericananimestudios.com/mothman/mapsubmit.php
And here is the code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
<form id="form1" name="form1" method="post" action="">
<p><label>Location Name
<input type="text" name="name" />
</label></p>
<label>Location Latitude
<input type="text" name="lat" />
</label>
<label>Location Longitude
<input type="text" name="lon" />
</label>
<p><br />
Don't know the latitude and longitude? Enter the address at <a href="http://geocoder.us">Geocoder.us</a>.
<label>
</p>
<p>Description
<textarea name="desc"></textarea>
</p>
<p><label>URL
<input name="url" type="text" value="http://" />
</label>
<p>
<label>Category
<select name="select">
<option value="2">Mothman</option>
<option value="1">Museum</option>
<option value="3">Historical</option>
<option value="4">Town</option>
</select>
<br />
<br />
</label>
<input type="file" name="imagefile"><br />
<p>
<input type="submit" name="Submit" value="Submit">
<?
if(isset( $Submit ))
{
//If the Submitbutton was pressed do:
copy ($_FILES['imagefile']['tmp_name'], "files/".$_FILES['imagefile']['name'])
or die ("Could not copy");
if ($_FILES['imagefile']['type'] == "image/gif"){
echo "";
echo "Name: ".$_FILES['imagefile']['name']."";
echo "Size: ".$_FILES['imagefile']['size']."";
echo "Type: ".$_FILES['imagefile']['type']."";
echo "Copy Done....";
}
if ($_FILES['imagefile']['type'] == "image/jpg"){
echo "";
echo "Name: ".$_FILES['imagefile']['name']."";
echo "Size: ".$_FILES['imagefile']['size']."";
echo "Type: ".$_FILES['imagefile']['type']."";
echo "Copy Done....";
}
if ($_FILES['imagefile']['type'] == "image/png"){
echo "";
echo "Name: ".$_FILES['imagefile']['name']."";
echo "Size: ".$_FILES['imagefile']['size']."";
echo "Type: ".$_FILES['imagefile']['type']."";
echo "Copy Done....";
}
else {
echo "<br><br>";
echo "Could Not Copy, Wrong Filetype (".$_FILES['imagefile']['name'].")<br>";
}
}
//repeat input
echo "Name: " . $name . "<br>";
echo "Lat: " . $lat . "";
echo "lon: " . $lon . "<br>";
echo "Description: " . $desc . "<br>";
echo "URL: " . $url . "<br>";
//open connection to database
$desc = addslashes($desc);
$link = mysql_connect("xxxxx:xxxxxx", "xxxxxx", "xxxxx")
or die("Could not connect: " . mysql_error());
msql_select_db("mothmap",$link)
or die("Can\'t use mothmap: " . mysql_error());
//insert values into subfinder table
$sql = "INSERT INTO mapdraft ";
$sql = $sql . "VALUES('','" . $lat . "','".$lon."','".$desc."','".$url"','".$select."','".$_FILES['imagefile']['name']."','".$name."')";
$result = mysql_query($sql,$link);
if($result)
{
echo "<p>Due to an error (" . mysql_error() . ")<br>, your entry could " . "not be loaded into the database."
. "Please return to <a href=\"index.php\">Home</a>,";
}
?>
</form>
</body>
</html>
http://allamericananimestudios.com/mothman/mapsubmit.php
And here is the code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
<form id="form1" name="form1" method="post" action="">
<p><label>Location Name
<input type="text" name="name" />
</label></p>
<label>Location Latitude
<input type="text" name="lat" />
</label>
<label>Location Longitude
<input type="text" name="lon" />
</label>
<p><br />
Don't know the latitude and longitude? Enter the address at <a href="http://geocoder.us">Geocoder.us</a>.
<label>
</p>
<p>Description
<textarea name="desc"></textarea>
</p>
<p><label>URL
<input name="url" type="text" value="http://" />
</label>
<p>
<label>Category
<select name="select">
<option value="2">Mothman</option>
<option value="1">Museum</option>
<option value="3">Historical</option>
<option value="4">Town</option>
</select>
<br />
<br />
</label>
<input type="file" name="imagefile"><br />
<p>
<input type="submit" name="Submit" value="Submit">
<?
if(isset( $Submit ))
{
//If the Submitbutton was pressed do:
copy ($_FILES['imagefile']['tmp_name'], "files/".$_FILES['imagefile']['name'])
or die ("Could not copy");
if ($_FILES['imagefile']['type'] == "image/gif"){
echo "";
echo "Name: ".$_FILES['imagefile']['name']."";
echo "Size: ".$_FILES['imagefile']['size']."";
echo "Type: ".$_FILES['imagefile']['type']."";
echo "Copy Done....";
}
if ($_FILES['imagefile']['type'] == "image/jpg"){
echo "";
echo "Name: ".$_FILES['imagefile']['name']."";
echo "Size: ".$_FILES['imagefile']['size']."";
echo "Type: ".$_FILES['imagefile']['type']."";
echo "Copy Done....";
}
if ($_FILES['imagefile']['type'] == "image/png"){
echo "";
echo "Name: ".$_FILES['imagefile']['name']."";
echo "Size: ".$_FILES['imagefile']['size']."";
echo "Type: ".$_FILES['imagefile']['type']."";
echo "Copy Done....";
}
else {
echo "<br><br>";
echo "Could Not Copy, Wrong Filetype (".$_FILES['imagefile']['name'].")<br>";
}
}
//repeat input
echo "Name: " . $name . "<br>";
echo "Lat: " . $lat . "";
echo "lon: " . $lon . "<br>";
echo "Description: " . $desc . "<br>";
echo "URL: " . $url . "<br>";
//open connection to database
$desc = addslashes($desc);
$link = mysql_connect("xxxxx:xxxxxx", "xxxxxx", "xxxxx")
or die("Could not connect: " . mysql_error());
msql_select_db("mothmap",$link)
or die("Can\'t use mothmap: " . mysql_error());
//insert values into subfinder table
$sql = "INSERT INTO mapdraft ";
$sql = $sql . "VALUES('','" . $lat . "','".$lon."','".$desc."','".$url"','".$select."','".$_FILES['imagefile']['name']."','".$name."')";
$result = mysql_query($sql,$link);
if($result)
{
echo "<p>Due to an error (" . mysql_error() . ")<br>, your entry could " . "not be loaded into the database."
. "Please return to <a href=\"index.php\">Home</a>,";
}
?>
</form>
</body>
</html>