Reputation: 23
please help me with this project, I have a form from a page
<form method="post" action="../download_form138.php" >
<input type="submit" name="download" value="download" id="<?php echo $row["id"]; ?>" class="btn-xs" />
</form>
and here is a piece of my download_form138.php
// CREATE A NEW SPREADSHEET + POPULATE DATA
$sheet = $spreadsheet->getActiveSheet();
$sheet->setTitle('Form 138');
$stmt = $pdo->prepare("SELECT * FROM q1 INNER JOIN sf1 ON q1.id = sf1.id WHERE q1.id = '".$_POST["download"]."' ");
$stmt->execute();
it does not download the data from the data base but when i change the
WHERE q1.id = '".$_POST["download"]."'
into WHERE q1.id = 5
, it downloads the data with the same id in my database, What i want to do is that when a user click download, it downloads the data from the database with the same id.
Upvotes: 0
Views: 697
Reputation: 623
You need to change the value, not the ID.
<form method="post" action="../download_form138.php" >
<input type="submit" name="download" value="<?php echo $row["id"]; ?>" class="btn-xs" />
</form>
Upvotes: 1