0

Hi I have a problem, I have created a site that allows for a user to bid on property but cant get a code to work where it updates a current record in the database

<form id="MakeBid" action="MakeBid.php" method="get">
<div>Bid Now <input type="text" name="pricesoldfor"/></div> 
<input type="submit" value="Place Bid" /> 
</form>

This is my form that im trying to use that will update the databse, each record has a primary key set as propertyID, any help would be appreciated

Thanks

Edited by sibbs06

4
Contributors
5
Replies
6
Views
5 Years
Discussion Span
Last Post by Biiim
0

Well let me look into my crystal ball too see your coding problem. If you have a problem, please post your code that you are having problems with. From this point i can tell you is to change method from get to post

0
<?php
    if (!isset($_REQUEST['pricesoldfor']) && ($_REQUEST['propertyID']))
    {die("<p>You have to complete all records before pressing add record.</p>\n");
    }

    $pricesoldfor=$_REQUEST['pricesoldfor'];
    $propertyID=$_REQUEST['propertyID'];


    if ($pricesoldfor!=""){
        include 'dbconnect.php';
    $sql="UPDATE property SET pricesoldfor WHERE propertyID = "$propertyID"";    


        mysql_query($sql) or die (mysql_error());
        mysql_close($connection);
        echo "bid of $pricesoldfor has been accepted";
    }
    else {
        die("<p> You have not entered all of the required fields </p>\n");
    }
?>

Sorry about that, this is the code i have so far but i cant see where i have went wrong, i have changed the form to look like this

<form id="MakeBid" action="MakeBid.php" method="post">
<input type="hidden" name="propertyID" value ="propertyID"/>
<div>Bid Now <input type="text" name="pricesoldfor"/></div> 
<input type="submit" value="Update" /> 
</form>

Edited by Ezzaral: Fixed code formatting.

0

Line 7 is wrong, change it to:

$sql = "UPDATE property SET pricesoldfor = $pricesoldfor WHERE propertyID = '$propertyID'";
0

$sql = "UPDATE property SET pricesoldfor = $pricesoldfor WHERE propertyID = '$propertyID'";

Thanks for the reply, i applied that to my code however I got this error

Parse error: syntax error, unexpected T_VARIABLE in /var/www/vhosts/numyspace.co.uk/web_users/home/~unn_v013362/public_html/case/MakeBid.php on line 83

You have any idea what this could be?

Thanks

0

thats a php compile error, you have some bracket/quote/semicolon missing somewhere. it will be on or before line 83 probably not too far back

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.