Hello to everyone, im having trouble getting the value of a combobox in HTML to php! Frist I import data from a mysql collum into the combobox, being this the value of the combobox! I want to be able to get the selected value when I submit my form. I tried using sessions but i always get the data of the last row inserted.
Heres the code that I have:
<?php
include "connect_database.php";
$query = mysql_query("SELECT id_expense, category_name FROM expenses") or die(mysql_error());
?>
......
<select name="expenses" >
<option value="0" selected="selected"> Choose</option>
<?php
while($row = mysql_fetch_assoc($query)){
// $id=$row["id_expense"];
$category = $row["category_name"];
?>
<option value= <?php $category ?> > <?php echo $category ?> </option>
<?php
}?>
</select>
How can i do this?