I am trying to send id from the current URL to the select.php
page but it is displaying id not defined and is not able to fetch any data.
I want to fetch for index suporder from the SQL table
for to display data that are for the fetched suporder id.
<script>
$(document).ready(function(){
function fetch_data()
{
$.ajax({
type:'post',
url:"select.php" + id ,
method:"POST",
dataType:"json",
success:function(data)
The (select.php) file to fetch the data from the AJAX query.
But this is not able to get id from the URL.
<?php
$connect = new PDO("mysql:host=localhost;dbname=mta_bd", "root", "");
$query = 'SELECT * FROM all_stores where suporder='.$_GET['id'];
$statement = $connect->prepare($query);
if($statement->execute())
{
while($row = $statement->fetch(PDO::FETCH_ASSOC)){
$data[] = $row;
}
echo json_encode($data);
}
?>
SQL db for fetching from index as suporder for id
Fetching id from the prev URL like this
echo '<td align="right">
<a type="button" class="btn btn-primary bg-gradient-primary" href="issue.php?id='.$row['suporder'] . '"><i class="fas fa-fw fa-list-alt"></i> Enter Data</a>
Error msg after the changing to console error at line url:"select.php?id=" + id, :
url:"select.php?id=" + id,
method:"POST",
dataType:"json",
success:function(data)