How can I go about passing a project ID while inserting. I’m using dhtmlXscheduler. Updating works fine since updating doesn’t need the project ID. However when I insert, I don’t know how to pass my project ID.
Javascript:
[code]scheduler.config.xml_date=“%Y-%m-%d %H:%i”;
scheduler.init(‘scheduler_here’,new Date(),“month”);
scheduler.load(“calendar_data.php?project_id=<?=$_GET['project_id']?>”);
scheduler.locale.labels.section_teamleader="Team Leader";
scheduler.locale.labels.section_team="Team";
scheduler.config.lightbox.sections=[
{name:"description", height:130, map_to:"text", type:"textarea" , focus:true},
{name:"teamleader", height:23, type:"select", options:scheduler.serverList("team_leader"), map_to:"team_leader"},
{name:"team", height:23, type:"multiselect", options:scheduler.serverList("team_leader"), map_to:"team"},
{name:"time", height:72, type:"time", map_to:"auto"}
];
var dp = new dataProcessor("calendar_data.php?project_id=<?=$_GET['project_id']?>");
dp.setTransactionMode("POST", false);
dp.init(scheduler);[/code]
Here’s the server code
[code]$scheduler = new schedulerConnector($db,“PDO”);
$scheduler->enable_log(“log.txt”);
$list = new OptionsConnector($db, “PDO”);
$list->render_table(‘logins’,‘id’,‘id(value), first_name(label)’);
$scheduler->set_options(“team_leader”, $list);
$scheduler->render_sql("SELECT * FROM activities WHERE project_id = ". $_GET[‘project_id’], “id”, “date_start, date_end, subject, project_id”);[/code]
I’m not sure how to pass my project ID to the insert. Here is what the log says:
INSERT INTO activities(date_start,date_end,subject,project_id) VALUES ('2011-10-07 00:00','2011-10-07 00:05','test','')
Do I need to make a hidden field in the javascript or is there a way to do it in the connector?