The values from the db are displaying in the dropdown and I've gotten it to work with text values that weren't pulled from the db, but when I try it with values from the db and click 'Submit' the page reloads and nothing happens.
My code:
<form action="test.php" method="post">
<br />
<label for="name">Choose a name</label><br />
<select name="selected_value">
$query = "SELECT * FROM items WHERE user_id = $user_id";
$select_items = mysqli_query($connection, $query);
confirmQuery($select_items);
while($row = mysqli_fetch_assoc($select_items)) {
$item_id = $row['item_id'];
$item_name = $row['item_name'];
echo "<option value='$item_name'>{$item_name}</option>";
</select>
<button type="submit" name="submit_form">Submit</button>
</form>
if(isset($_POST['submit_form'])){
$selected_value = $_POST['selected_value'];
echo $selected_value;
}