hello folks
I'm a greenhorn in PHP so excuse me if i'm being dumb.
I have set up a page that is pulling records out of a database table, the user viewing the page is intended the choose a number of the records on the page (using checkboxes) and download as CSV to use for referencing.The problem is that i dont know the technique to do this.
the code looks like this
<?php
include 'data.php';
try{
$con = new PDO('mysql:host=localhost;dbname=abc', $user, $pass);
$con->SetAttribute (PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$sql=$con->prepare('select id, title, author, secondary_title, year, volume, number, pages from refs');
$sql->execute();
$sql->setFetchMode(PDO::FETCH_ASSOC);?>
<!doctype html>
<html style="width:100%;height:100%">
<head>
<title>Scholar</title>
<link href="authors.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id = "container">
<form action = "<?Php echo $_SERVER['PHP_SELF'];?>" method = "post">
<?php
while ($row = $sql->fetch()){
$id = $row ['id'];
$title = $row ['title'];
$author = $row ['author'];
$secondary_title = $row ['secondary_title'];
$year = $row ['year'];
$volume = $row ['volume'];
$number = $row ['number'];
$pages = $row ['pages'];
//$ref = $row["'$volume' . '($number)' . '$pages'"];
echo "<input type = 'checkbox' name='checkbox[]' value=''>$id <a href =''>$title \n </a> </br> $author \n </br> $secondary_title $year $volume($number):$pages </br><p>";
}?>
<input type = "submit" name="submit">
</div>
</body><?php
}
catch (PDOException $e){
echo 'ERROR:'. $e->getMessage();
}
$con = null;
?>
you can view the attached thumbnail.