I'm still trying to achieve the following:
After successful login the editing-view is opened with the respective user's personal record, i.e. without entering the list-view first.
In case that there is no personal record yet, it should be created automatically.
So I tried the following event-code:
(UID and Uid respectively define the ownership of the record, Email is used as the username)
[codebox]// After successful login
function AfterSuccessfulLogin($username, $password,&$data)
{
global $conn;
$strSQLExists = "select from _bewerbung where UID='". $data['Uid']."'";
$rsExists = db_query($strSQLExists,$conn);
$data=db_fetch_array($rsExists);
if($data)
{
header("Location:_bewerbung_edit.php");
}
else
{
$strSQLInsert = "insert into _bewerbung (UID, Email) values (" . $data['Uid']."," .$username. ")";
db_exec($strSQLInsert,$conn);
$strSQLExists = "select from _bewerbung where UID='". $data['Uid']."'";
$rsExists = db_query($strSQLExists,$conn);
$data=db_fetch_array($rsExists);
header("Location:_bewerbung_edit.php");
}
} // function AfterSuccessfulLogin
[/codebox]
This code opens the edit-page, but without loading the record, but with an empty form to create a new one.
I also tried to append a "?editid1=$data[Pkey]" (PKey ist the primary key which is used to reference the records from the *list.php page) argument to "_bewerbung_edit.php", but to no avail.
So how do I get the selected record loaded to the edit-form?
I was arguing that $data = db_fetch_array() would load all the db-fields to the respective form-fields, but, obviously, this isn't the case...
?
tia, paul