I have a form that contains names of columns in a select. How do I pass the value of that select into a mysql statement.
Here is part of my code:
The mysql table is:
id-cash-credit_cards-bill_to_room
The form is:
<form action="display.php" method="post">
<select name="show_by" id="show_by" onchange="submit()">
<option value="">--Select--</option>
<option value="cash">Cash</option>
<option value="credit_cards">Credit Cards</option>
<option value="bill_to_room">Bill To Room</option>
<option value="ten_minutes">Ten Minutes</option>
</select>
Then display.php has the following
$result = mysql_query("SELECT property, SUM('$_POST[show_by]') as total FROM table");
Why this doesn't work?
Thanks.