Hi all, the background to what I want to do is.... Fill in a form on a web page > data gets put into the database but with a 1 in the approval field > i will then review the data on another page in a form format, with 2 buttons submit and reject. I want the submit button to update the database and change the 1 to a 0 meaning its approved, I might also change other information that has been subbmited. The reject button which I havnt coded yet when pressed will delete that row from the database.
I have got so far with the code and now get a parse error, unexpected T_STRING and cant seem to get round it.
The error is on this line:
$sql = 'UPDATE 'klmreal' SET 'name' = '$name', 'emailaddress' = '$emailaddress', 'approval' = '0' WHERE 'id' = $_POST['id']';
the full code is...
<?php
if ($submit) {
// process form
$db = mysql_connect("localhost", "*****", "*****") or die("Could Not Connect To The Database. <br>" . mysql_error());
mysql_select_db("****",$db) or die("Could Not Select The Proper Database. <br>" . mysql_error());
$name = $_POST['id'];
$name = $_POST['name'];
$emailadress = $_POST['emailaddress'];
$approval = $_POST['approval'];
$sql = 'UPDATE 'klmreal' SET 'name' = '$name', 'emailaddress' = '$emailaddress', 'approval' = '0' WHERE 'id' = $_POST['id']';
$result = mysql_query($sql);
if($result)
{
echo "Data Properly Inserted";
}
else
{
echo "An Error occured while trying to process your information.";
print ("<br>" . mysql_error());
}
echo $sql ;
echo "Thank you! Information entered.\n";
}
else
{
?>
So once that works, and I duplicate the code to do a if($reject) what is the code for deleting that row from the database?
Thanks in advance
Lee