Basically, what laserlight did was make sure that the only thing inside the quoted echo strings is the HTML data you want outputted; NOT a single character of PHP code.
In this part of your attempted correction above:
echo '
<form action="' . $_SERVER['PHP_SELF'] . '" method="POST">
quality name: <select name="quality_name">
$sql = "SELECT quality_name FROM quality_info"';
you should note that the $sql variable is inside the echo statement, so instead of actually carrying out what you're trying to tell PHP, it's instead trying to output it. To correct that bit, all laserlight did was to end the echo statement before any PHP code so that the only thing outputted, or echoed, to the browser is the HTML data, like so:
echo '
<form action="' . $_SERVER['PHP_SELF'] . '" method="POST">
quality name: <select name="quality_name">';
$sql = "SELECT quality_name FROM quality_info";
Note the difference in the placement of the quotes for the echo statement and even the color-coding.