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

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

<?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>

Line 7 is wrong, change it to:

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

$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

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.