I want to hear from ...
';
$key = 'hear';
$sql = "select count(a) from {survey} where q='%s' and uid=%d";
$count = db_result(db_query($sql, $key, $user->uid));
if (isset($_POST['submit'])) {
if (!empty($_POST['name'])) {
$sql = "insert into {survey} (uid, q, a) values (%d, '%s', '%s')";
db_query($sql, $user->uid, $key, $_POST['name']);
}
print 'Thanks for taking our survey. Your answer has been included in the results below.';
} else {
if ($user->uid) {
if ($count == 0) {
?>
Responses so far:
- ";
while ($data = db_fetch_object($result)) {
print '
- ' . $data->a . ' (' . $data->count_a . ') '; } print '