The query itself is invalid "m$selected" is the problem, also you are using "mysql_fetch_field" which will get information about the current field, but I don't think that's what you want.
This is what I think you're after:
PHP Code:
<?php
if (isset($_POST['q1'])) {
$selected = $_POST['q1'];
$query = "SELECT * FROM `{$selected}`";
// As long as $selected is a valid fieldname
$result = mysql_query($query);
if(!$result)
die(mysql_error());
else {
while($data = mysql_fetch_array($result)) {
echo $data['FIELDNAME_HERE'] . '<br />';
}
}
}
?>
Should work.
Bookmarks