I am making a very simple address book. The following script inserts data into a database.
if ($id) {
$sql = "UPDATE hgw_addressbook SET addressName = '$name', addressEmail = '$email', addressSelect = '$select', addressMessage = '$message' WHERE addressID = '$id'";
} else {
$sql = "INSERT INTO hgw_addressbook (addressName, addressEmail, addressSelect, addressMessage, addressURL) VALUES ('$name', '$email', '$select', '$message', '$url')";
}
Here $id is data from a simple POST HTML form. If $id = 'true' then it edits an existing record, else it adds a new address. This works OK for me.
However, currently 'register_globals = on', but I want my script to work if I turn them off.
I have tried replacing
if ($id)
with
if (isset($_REQUEST['id']))
but I can not add new data to the database.
Any tips would be much appreciated. Ta!