Hi all,
I have a drop down list, which pulls data from a MySQL table. This table currently has only two rows, but could certainly have more with eventual data entry.
The purpose of the drop down is the specify a variable that will then be used on the next page to retrieve only certainly rows from a different table.
Here's the drop down code I plucked from the Internet (all comments are from the original sample script):
<?php
// modified from sample script at http://www.plus2net.com/php_tutorial/list-table.php - 03/26/12 rjm
if(!isset($_SESSION))
{
session_start();
}
include('connection.php');
$query="SELECT feed_title,feed_id FROM feeds";
/* You can add order by clause to the sql statement if the names are to be displayed in alphabetical order */
$result = mysql_query ($query);
echo "<select name=feed_title value=''>Feed Name</option>";
// printing the list box select command
while($nt=mysql_fetch_array($result)){//Array or records stored in $nt
echo "<option value=$nt[feed_id]>$nt[feed_title]</option>";
/* Option values are added by looping through the array */
}
echo "</select>";// Closing of list box
echo " <a href=\"index.php?action=additem\">Feed</a><br>";
echo "</h2>";
echo "test";
echo $nt[feed_id];
?>
What my intention would be is to pass the variable for the selected feed title on when I click the Feed hypertext link. I'm not necessarily married to this we of doing it if there's a more efficient way of doing it.
Thanks for looking,
Robert