pass the tablename to getData.php in flutter

Tags: , , ,

I am making a flutter application using MySQL. In the home page I have a listview as shown below. The database has unique tables for each item in the list view.

What I want is that when I am calling http.get to get all the data from a particular table as per the query mentioned in getData.php, there must also be a procedure to send that table name to that php file so that the query should be completed.

This is getData.php:

include 'conn.php';
$Table = $_POST['Tablename'];
$query = "select * from ".$Table;
$data = mysqli_query($conn, $query);
$result = array();
while ($row = mysqli_fetch_array($data)) {
    $result[] = $row;
echo json_encode($result);

and here is the code which I have written to fetch the data. What can I write to send the tablename to getData.php:

  Future<List> getQue() async {
    var response = await http.get(url);
    return json.decode(response.body);


Use post instead of get for your http call;

Future getQue() async {
  var response = await, body:{'Tablename': your-table-name});
  return json.decode(response.body);

Source: stackoverflow