1
Questions / Re: Insert into DB from a javascript or FORM within PHPrad
I will try to explain it.
I try to include Jquery-Seat-Chart (https://github.com/mateuszmarkowski/jQuery-Seat-Charts) into my first page with PHPRad.
It shows up and works with some restrictions caused by the separation between server side php and the jquery client side plugin.
Two problems are now unresolved:
I write and fill up a html form with jquery-seats and will fire this form up against a PHP server side page doing the db connection and save the givven informations.
First try was a page under app/views/partial but a can't establish a connection with the db because I don't know how to instanciate it.
With ...
$cmtc = new PresenceController;
$db = $cmtc->GetModel();
my Controller is unknown.
And the second problem is how can I use a Page OnLoad with PHPRad to change for example my seat chart with javascript and informations coming from the db.
I am currently trying to solve this with a "After View List" command with "window.onload" with the same problems caused by to less knowledge (sc unknown).
Quote
$seatList = $db->rawQuery("select `m`.`firstname` AS `firstname`,`m`.`lastname` AS `lastname`,`p`.`comment` AS `comment`,`p`.`channel` AS `channel`,date_format(`p`.`date_created`,'%d.%m.%y %H:%i') AS `datef`,date_format(`e`.`event_date`,'%d.%m.%Y') AS `edate`,to_days(`e`.`event_date`) - to_days(current_timestamp()) AS `days`,`m`.`seat` AS `seat` from ((`presence` `p` join `members` `m`) join `events` `e`) where `p`.`presence` = 'excused' and `m`.`id` = `p`.`member_id` and `e`.`id` = `p`.`event_id` order by `m`.`loginname`");
//update the seat map
echo " <script>";
echo " window.onload = function seatUpdate() { ";
foreach ($seatList as $seat) {
echo "sc.status('" . $seat['seat'] . "','unvailable') //set status for one seats \n\n";
}
echo " }";
echo " </script>";
Thanx for your try to help me.