Please see the code I have for selecting items in a database via addgallery.php which are then added to that database. If the specific tour category (e.g. cornwall or prague) are not in the database, then obviousley, these will not show up. However, If i am submitting a new tour, I want to be able to type in a tour name and have that info add to the DB (this would then come up as one of the opitons in the select box when the process is started again as it has been added to the D😎.
<SELECT name="tour">
<?php
$db = "gallery";
$link = mysql_connect( "path", "user" );
if ( !$link ) die( "Couldn't connect to MySQL".mysql_error() );
mysql_select_db( $db, $link ) or die( "Couldn't open $db: ".mysql_error() );
$query = "SELECT DISTINCT (tour) FROM galleryTable ORDER BY tour";
$result = mysql_query( $query, $link ) or die( "Couldn't execute query".mysql_error() );
while ($row = mysql_fetch_array( $result )) {
$tour = $row["tour"];
print "<OPTION value=\"$tour\" size=\"20\">$tour</OPTION>";
}
mysql_close( $link );
?>
</SELECT>
All help most gratefully received!
Thanks