My problem here is that although I seem to retrieve the id for the selected property and am able to show up the property details on the requested browser, I am unable to get that particular property's id to show up in my database when the user enters their bid further down the page on that property.
I am including code. The troublesome code lies between lines 60 and 69.
Code: Select all
<?
include "session.php";
mysql_connect(" ", " ", " ") or die(mysql_error());
mysql_select_db("property") or die(mysql_error());
if (isset($_GET['id'])) { ?>
<head><?include "menu.php";?></head>
<br>
<br>
<br>
<?
// Put the value in a separate variable
$propID = mysql_real_escape_string($_GET['id']);
$query = "select propertyArea, propertyPrice, propertyType, propertyBedrooms, propertyDescription, propertyImage1 from property where propertyID = $propID ORDER BY 'propertyID'";
$result = mysql_query($query);
while ($row = mysql_fetch_row($result))
{
?>
<HTML>
<BODY>
<table ALIGN = "LEFT">
<font face="Arial" color="#0B3A62">
<?echo $row[0]; ?> ,
£<? echo $row[1]; ?> ,
<? echo $row[2]; ?> ,
<? echo $row[3]; ?> bedroomed,
<? echo $row[4];?>
<? echo $row[5];?>
<br>
<br>
<tr><tr><td><?echo "<img src =\"showimage.php?id=$row[propertyID]\">";?></td></tr></tr>
</br></br>
<?
}
if($session->logged_in){
?>
<br>
<br>
<table align = "LEFT">
<TR>
<TD>
<form action = "bid.php" method = "POST">
<font face="Arial" color="#0B3A62">
Bid value: <input type = "text" name = "bidvalue" value = ""></td></tr></table>
<table align = "LEFT" VALIGN = "bottom">
<tr><td><input type="submit" value="Submit bid"></font></form></td></tr></table></br></br>
<?
$bid = mysql_real_escape_string($_POST['bidvalue']);
if(!empty($bid)){
$result = mysql_query($query);
$user = mysql_real_escape_string($_SESSION['username']);
$propID = $_GET['id'];
$q = "INSERT INTO bid(username, bidvalue, propertyid) VALUES ('$user', '$bid', '$propID') ";
return mysql_query($q) or die(mysql_error());
}}
else {
?> <font face="Arial" color="#0B3A62">
<?
echo "<br><br>You must login to bid on this property. Click on the button below to login." ?>
</font>
</TABLE>
<br><br>
<table align = "LEFT" VALIGN = "bottom">
<tr><td><form action = "main.php"><input type="submit" value="Login to bid"></form></td></tr></table>
<?
}}?>
</BODY>
</HTML>