G
Guest
Guest
I am using an html form to try and post to a MySQL database. When I submit the form, it says the information has been entered, but when I view the database contents, the new info isn't there. I am really clueless about all of this but I'm learning. I am including the code of both files below.
First, the form:
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>Add a Property Listing</title>
</head>
<body>
<form method="POST" action="addlisting.php3" name="Add Listing">
<p>City <input type="text" name="city" size="20" tabindex="1"></p>
<p>Street <input type="text" name="street" size="20" tabindex="2"></p>
<p>Listing Price <input type="text" name="price" size="20" tabindex="3"></p>
<p>Bedrooms <input type="text" name="bedrooms" size="2" tabindex="4">
Baths <input type="text" name="baths" size="2" tabindex="5"> SQ Feet <input type="text" name="sqfeet" size="5" tabindex="6"></p>
<p>Directions:</p>
<p> <textarea rows="2" name="directions" cols="58" tabindex="7"></textarea></p>
<p>Description:</p>
<p><textarea rows="2" name="description" cols="59" tabindex="8"></textarea></p>
<p>Picture Name <input type="text" name="picture" size="20" tabindex="9"></p>
<p> </p>
<p><input type="submit" value="Submit" name="Add Listing"><input type="reset" value="Reset" name="B2"></p>
</form>
</body>
</html>
Now, the .php3:
<?php
$db = mysql_connect("localhost", "username", "password");
mysql_select_db("scbankforeclosures_com",$db);
$sql="INSERT INTO LISTINGS (city, street, price, bedrooms, baths, sqfeet, directions, description, picture) VALUES ($city, $street, $price, $bedrooms, $baths, $sqfeet, $directions, $description, $picture);";
$result = mysql_query($sql);
echo "Thank you! Information entered.\n";
?>
Obviouusly, I use the correct username and password in the actual file.
Any ideas?
Thanks! :?:
First, the form:
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>Add a Property Listing</title>
</head>
<body>
<form method="POST" action="addlisting.php3" name="Add Listing">
<p>City <input type="text" name="city" size="20" tabindex="1"></p>
<p>Street <input type="text" name="street" size="20" tabindex="2"></p>
<p>Listing Price <input type="text" name="price" size="20" tabindex="3"></p>
<p>Bedrooms <input type="text" name="bedrooms" size="2" tabindex="4">
Baths <input type="text" name="baths" size="2" tabindex="5"> SQ Feet <input type="text" name="sqfeet" size="5" tabindex="6"></p>
<p>Directions:</p>
<p> <textarea rows="2" name="directions" cols="58" tabindex="7"></textarea></p>
<p>Description:</p>
<p><textarea rows="2" name="description" cols="59" tabindex="8"></textarea></p>
<p>Picture Name <input type="text" name="picture" size="20" tabindex="9"></p>
<p> </p>
<p><input type="submit" value="Submit" name="Add Listing"><input type="reset" value="Reset" name="B2"></p>
</form>
</body>
</html>
Now, the .php3:
<?php
$db = mysql_connect("localhost", "username", "password");
mysql_select_db("scbankforeclosures_com",$db);
$sql="INSERT INTO LISTINGS (city, street, price, bedrooms, baths, sqfeet, directions, description, picture) VALUES ($city, $street, $price, $bedrooms, $baths, $sqfeet, $directions, $description, $picture);";
$result = mysql_query($sql);
echo "Thank you! Information entered.\n";
?>
Obviouusly, I use the correct username and password in the actual file.
Any ideas?
Thanks! :?: