Hi Rob,
This should work for you.
I made the table a little easier to work with
but the code should remain the same.
Hope that helps.
All the best,
Peter.
Here is the table structure i used:
DROP TABLE IF EXISTS information;
CREATE TABLE information(
record_number int(10) NOT NULL,
title varchar(255),
entry text NULL,
source varchar(100),
PRIMARY KEY (record_number)
);
#
Dumping data for table 'salary'
#
INSERT INTO information (record_number, title, entry, source)
VALUES ( '0000000001', 'Title 1', 'text field 1', 'source 1');
INSERT INTO information (record_number, title, entry, source)
VALUES ( '0000000002', 'Title 2', 'text field 2', 'source 2');
INSERT INTO information (record_number, title, entry, source)
VALUES ( '0000000003', 'Title 3', 'text field 3', 'source 3');
Here is the PHP code:
<?php
include("goconfig.php");
//holds the variables for hostname, username, password used in mysql_connect below
echo "<body>";
$connection = mysql_connect($hostname, $user, $pass) or die ("Unable to connect!");
$news_query = mysql_query ("SELECT * FROM gores.information") or die ("Invalid query");
// I use the format database_name.table_name, in this case my database is called
// gores
echo "<FORM action=\"whatever_happens_next.php\" method=\"POST\">";
echo "News Title: ";
echo "<select name=\"title\">";
while (list($record_number, $title) = mysql_fetch_row($news_query))
//extract what I need using list
{
echo "<option value=$record_number>$title</option>";
}
echo "</select>";
echo "<INPUT TYPE=SUBMIT NAME=Submit VALUE=\"submit\">";
echo "</FORM></body>";
?>