I have got the following code that works and displays a list of people from the database using a query on the previouse page.
Is it now possible to add a button that says export as csv file, and then export the results as a csv file?
TIA
Is it now possible to add a button that says export as csv file, and then export the results as a csv file?
PHP:
<?php
$link = mysql_connect('localhost', '****', '*******');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
$Course=$_POST["category"];
mysql_select_db("misstudents", $link);
$query="SELECT * FROM misimport WHERE Course = '" . mysql_real_escape_string($_POST["category"]) . "'";
$result = mysql_query ($query);
?>
</head>
<body><div id="wrap"><div id="header"><h1>Moodle Upload Tool</h1>
</div>
<div id="main">
<?php echo $_POST["category"];
echo "<table border='2'>";
while($row = mysql_fetch_array($result))
{
echo "<tr><td>";
echo $row['Id'];
echo "</td><td>";
echo $row['Id'];
echo "</td><td>";
echo $row['DOB'];
echo "</td><td>";
echo $row['Firstname'];
echo "</td><td>";
echo $row['Surname'];
echo "</td><td>";
echo $row['BACOLL'];
echo "</td><td>";
echo $row['Course'];
echo "</td>";
echo "</tr>";
}
echo "</table>";
?>
TIA