Your problem is with this particular line.
if (!isset($_POST['submit'])) {
print "dish name: " .$_POST['dish_name'];
}
Your only checking if it isn't submitted. But what if it's submitted? I assume you want to continue with the rest of the codes right? So do this..
<?php
require 'DB.php';
if (!isset($_POST['submit'])) {
print "dish name: " .$_POST['dish_name'];
}
else {
// connect to the data base
$db = DB::connect('mysql://xxxx:xxxxx@localhost');
if (!db){
//didnt connect
print "not connected";
}
else {
// connected so lets pull our items from the db
print "were in!";
mysql_select_db("test");
$query = 'SELECT dish_name FROM dishes';
$results = mysql_query($query);
// get items put them i
if (mysql_num_rows($results) > 0) {
print '<form action="sql.php" method="POST" enctype="text/plain">';
print '<select name=\"'.'dish_name\" '.'"size=\"'.'20\"'. 'height=\"'.'1\"'.'>';
while ($row = mysql_fetch_object($results)) {
print '<option value='.$row->dish_name.'>'.$row->dish_name.'</option>';
}
print '</select>';
print '<input type="'.'submit"'.' value="'.'submit"'.'name="'.'submit" /></form>';
}
else{
print "no rows";
}
}
}
?>