Edit: If the row hasn't been created yet, it can't be returned by the DB. Therefore, you are trying to access a given page in 2 different ways.
You can do something like the following:
$object = null;
if (isset($_REQUEST['id'])) {
//call the DB to access the record data and put it
//into the $object that's representing that table.
}
else if (isset($_SESSION['data to display'])) {
//retrieve that data and set the values on $object
//then...
unset($_SESSION['data to display']);
}
else {
// bad input data. either call die() with an error message,
//or redirect to an error page, or do whatever else you might
//want to do.
}
From here on, everything should be common functionality for building the actual page.