javascript - Sending ID to php via load function
285
I have the below javascript function and php file. I want to take the id in the URL and send it to PHP so that I can query the data by the particular ID on the page. Here is what I have so far. Let me know what needs to be changed in order to get this to work. Thanks
javascript:
/*adding data*/
dhx.ready(function () {
dhx.ui.fullScreen();
dhx.ui({
view: "scheduler",
id: "scheduler"
});
$$("scheduler").load("placevents.php?id=" + getID, "scheduler");
/*preselects Month view*/
$$("scheduler").$$("month").show();
$$("scheduler").$$("buttons").setValue("month");
});
PHP:
//Retrieve logged in user
$test = "[email protected]$_REQUEST['id']";
$scheduler = new schedulerConnector( $res, "MySQL" );
$scheduler -> enable_log( "log.txt", true );
$scheduler -> render_table("events LEFT JOIN tblfollowers ON events.id_user = tblfollowers.username"
. " WHERE events.status = 'active' AND((events.id_user) ='$test')"
. " GROUP BY events.event_id, events.event_name, events.user_name, events.id_user, events.time, events.details, events.location, events.dresscode"
. " Order By events.timestamp DESC","event_id","start_date, start_date,event_name,details");
$scheduler -> render_sql("select event_id, start_date, end_date, event_name, details from events ");
Answer
Solution:
Please post full source code, however I think that there are two error first you must modify this:
Into this:
This help you to prevent sql injection.
And as I say above I don't know you source code but I think that there are an other error:
Try to modify it into this: