BUMP!!!
Please help me guys.. ..
ive worked some of this out, had to do with forwarding the variables on to the next part of the program with a form . ..
but i still can't get some of the information to get entered into the database, i can't see what im doing wrong..
this is the code for the prog that allows the user to enter information to submit to the database..
PHP Code:
<?php
/* Program: chooseSuburb.php
* Desc: Allows the user to enter the information for the property. First, the program checks
* for a new category and enters it into the propertyType table if it is new. Then, all
* properties in the selected category are displayed with radio buttons. The user can
* enter a new name. Fields are provided to enter the description, price, and picture
* file name
*/
?>
<?php
if (@$newbutton == "Return to property type page" or
@$newbutton == "Cancel")
{
header("Location: choosePropType.php");
}
?>
<html>
<head><title>Add Property</title></head>
<body>
<?php
include("***.inc");
include("functions.inc");
$connection = mysql_connect($host, $user, $password)
or die ("couldn't connect to server");
$db = mysql_select_db($database,$connection)
or die ("couldn't select database");
/* if new was selected for property type, check if text fields were filled in. if they were not filled in,
display them again for the user to enter the type and type description. when the
fields are filled in, store the new type in the propertyType table.*/
if($propType == "new")
{
if ($newType == " " or $newDesc == " ")
{
include("newType_form.inc");
exit();
}
/* add new suburb to property table */
else
{
addNewType($newType, $newDesc);
$propType = $newType;
}
}
/* Select suburb names from table with giventype. if user entered a new type, it is
searched for. */
$query = "Select distinct propSuburb from property
where propType='$propType' ORDER BY propSuburb";
$result = mysql_query($query)
or die ("Couldn't execute query 3.");
$nrow = mysql_num_rows($result);
/* create form */
echo "<div style='margin-left: .1in'>";
echo "<form action='addProperty.php' method='post'>\n";
echo "<p><b>Suburb</b></p>\n";
if ($nrow < 1)
{
echo "<hr><b>No suburb names are currently in the database for the type
$propType</b><hr>\n";
}
else
{
echo "<table cellpadding='5' border='0'>";
echo "<tr>";
while ($row = mysql_fetch_array($result) )
{
extract($row);
echo "<td>";
echo " <input type='radio' name='newSuburb' value='$propSuburb' ";
echo " >$propSuburb</td>\n";
}
echo "</tr></table>";
}
include("newSuburb_table.inc");
$propDetails=" "; $propPrice =" "; $propImage =" ";
include("propInfo_table.inc");
echo "<input type='hidden' name='propType'
value='$propType'>\n";
echo "<input type='hidden' name='propPrice'
value='$propPrice'>\n";
echo "<input type='hidden' name='propImage'
value='$propImage'>\n";
echo "<p><input type='submit' value='Submit Suburb Name'>
<input type='submit' name='newbutton' value='Cancel'>
</form>\n";
?>
</div>
</body>
</html>
and this is the code for the programs that ads it and shows the feedback page..
PHP Code:
<?php
/* program: addProperty.php
Desc: add new property to the database. a confirmation screen is sent to the user
*/
if (@$newbutton == "Cancel")
{
header("Location: choosePropType.php");
}
if ($propSuburb == "new")
{
if ($newSuburb == "")
{
include("newSuburb_form.inc");
exit();
}
else
{
$propSuburb = ucfirst(strtolower(strip_tags(trim($newSuburb))));
}
}
if ($propImage == "")
$propImage ="na.gif";
?>
<html>
<head><title>Add Property</title>
</head>
<body>
<?php
include("***.inc");
$connection = mysql_connect($host,$user,$password)
or die ("Couldn't connect to server");
$db = mysql_select_db($database,$connection)
or die ("Couldn't select database");
$query = "INSERT INTO property (propType, propName, propDetails, propPrice, propImage, address, propSuburb, propFeatures)
VALUES
('$propType', '$propName', '$propDetails', '$propPrice', '$propImage', '$address', '$propSuburb', '$propFeatures' )";
$result = mysql_query($query)
or die ("Couldn't execute query");
$propId = mysql_insert_id();
echo "The following property has been added to the Property Listing:<br>
<ul>
<li>Property Type: $propType
<li>Property Name: $propName
<li>Property Details: $propDetails
<li>Price: $propPrice
<li>Picture File: $propImage
<li>Address: $address
<li>Suburb: $propSuburb
<li>Features: $propFeatures
\n";
echo "</ul>";
echo "<a href='choosePropType.php'>Add another property</a>\n";
?>
</body?
</html>
is this enough info??