Reputation: 75
Amateur here... I have an SQL query on an JS page and need to pass the variables onto a PHP webpage. I know how to pass the more simple variables through the URL, but am struggling in finding and executing the most efficient way to passing a long string, i.e. the text description of a point
Here on the JS side, I have:
downloadUrl("php_genxml1.php", function(data) {
var xml = data.responseXML;
var points = xml.documentElement.getElementsByTagName("point");
for (var i = 0; i < points.length; i++) {
var id = points[i].getAttribute("id");
var name = points[i].getAttribute("name");
var description = points[i].getAttribute("description");
var url = "PHPWebPage.php?name=" + name + "&id=" + id;
To get the id from the URL, I have used stuff like the standard
$id=$_GET['id'];
I know I could re run a query based off that id from the URL, but that surely doesn't sound the most efficient. I know my options (array, sessions, etc) for whatever that's worth.
Thanks for any help, C
Upvotes: 0
Views: 404
Reputation: 533
Try POSTing the data instead. It also makes it less likely for someone to just edit your URL in the browser to get data they're not supposed to have.
Upvotes: 1