Reputation: 127
Would it be possible to run a MySQL query pulling the names of locations from a table, inserting them into a dropdown menu and then automatically generating a URL for each one e.g. blablabla.bla/index.php?location=blablabla
every time the page loads?
Any help is appreciated.
Upvotes: 0
Views: 115
Reputation: 15409
Sure, you would just run the query, parse the results through a loop in which you would build your links from the returned values -- concatenating the result text to the other portion of your links.
<select name='locations'>
<?php
while ($row = mysql_fetch_assoc($result))
{
echo "<option value='".$row['location']."'>".$row['location']."</option>";
}
?>
</select>
Upvotes: 3