Good afternoon. I have a simple form of a calendar that writes the location data, event name and etc, then I have another one that writes the participating users, I would like to know how to get the ID of this previous form (event recording). To write to the participants form, and then you can relate.
Write First Form
Case 'salvar';
$data = '';
$data = implode('-', array_reverse(explode('/', $_POST['data_agenda'])));
if (app::$key) {
$sql = "update agenda set compromisso_agenda='" . $_POST["compromisso_agenda"] . "'
,data_agenda='$data',hora_agenda='" . $_POST["hora_agenda"] . "',pessoa_agenda='" . $_POST["pessoa_agenda"] . "',local_agenda='" . $_POST["local_agenda"] . "' where id_agenda=" . app::$key;
} else {
$sql = "insert into agenda (compromisso_agenda,data_agenda,hora_agenda,pessoa_agenda,local_agenda)
values ( '" . $_POST["compromisso_agenda"] . "','$data','" . $_POST["hora_agenda"] . "','" . $_POST["pessoa_agenda"] . "','" . $_POST["local_agenda"] . "')";
}
$dados = connection::exec($sql);
header('Location: ' . URL . 'agenda/pessoas');
break;
Recording according to the form
case 'salvar-pessoa':
$agendap_id = fetchColumn(0);
if (app::$key) {
$sql = "update agendap set agendap_id='$agendap_id',agendap_pessoa='" . $_POST["agendap_pessoa"] . "' where id_agenda=" . app::$key;
} else {
$sql = "insert into agendap (agendap_id,agendap_pessoa)
values ( '$agendap_id','" . $_POST["agendap_pessoa"] . "')";
}
$dados = connection::exec($sql);
header('Location: ' . URL . 'agenda/exibir');
break;