I have created a dropdown list and populated it with Mysql. I am trying to fetch the results of the users selection to show on 2 different pages permanently but I can't get it to work.
here is my code:
<?php
// Connect to the test datbase on localhost
// That's where we created the countries table above
mysql_connect('localhost','jakeray','pass'); mysql_select_db('wordpress');
// Query the countries table and load all of the records
// into an array.
$sql = 'select * FROM manufacturers';
$res = mysql_query($sql) or die(mysql_error());
while ($rec = mysql_fetch_assoc($res))
$manufacturers[] = $rec;
?>
<?php
echo '<select action="select.php" name="dropdown" class="select">';
foreach ($manufacturers as $c)
{
if ($c['id'] == $_GET['id'])
echo "<option value=\"{$c['id']}\" selected=\"selected\">{$c['mfg']}, {$c['info']}</option>
";
else
echo "<option value=\"{$c['id']}\">{$c['mfg']} {$c['info']}</option>
";
}
echo '</select>';
?>
<?php
if(isset($_POST['select']))
{
$manufacturers=mysql_real_escape_string($_POST['dropdown']);
$result=mysql_query("SELECT FROM manufacturers");
$row=mysql_fetch_assoc($result);
print $row['mfg'];
}
?>
I need to display the manufacturer permanently on 2 pages. Not sure if this is right.
How do I fetch the results of the selection from the database on two different pages and make it stay longer after the session expires.