I am trying to design a website for my project and I got confused in the following.If I want to add a dropdown menu I do it with the following code.
<select>
<option value="January"<?php if ($row[month] == 'January') echo ' selected="selected"'; ?>>January</option>
<option value="February"<?php if ($row[year] == 'February') echo ' selected="selected"'; ?>>February</option>
</select>
But what I want to do is following.I have a database and bunch of data which I will query with a select statement.And I want to give all of them as an option to do this drop-down menu.How can I accomplish it?To simplify the question assume I have a query
$sql= "select Name FROM Course WHERE courseName='".$something."'";
$resulting=mysqli_query($connection,$sql);
$resultarray=mysqli_fetch_array($resulting);
How can I accomplish this?
Edit:Without a dropdown menu I would normally create a form in this way.
<form action="restaurantAction.php" method="post">
Restaurant Name:<input type="text" name="deleteRestaurant">
<input type="submit">
</form>
How can I apply this to a drop down menu based on the answer of Minh
foreacharray item create an<option>