related dropdown list
<p>I'm new in PHP.. I need your help..</p>

<p>I have 2 dropdownlist that related:</p>

<p>dropdown 1 : manually insert the value</p>

<p>dropdown 2 : attach value from database (value based on condition that selected in dropdown 1)</p>

<p>Then, both value which are selected will display in textbox at another form.</p>

<p>My problem is:</p>

<p>1) The value in 2nd dropdown can't be display.</p>

<p>2) The value in 1st dropdown can pass to other form but the 2nd can't.</p>

<p>Please kindly guide me.</p>

<p>I don't know how to share my code here.</p>

<p>form1.php</p>

<p>//1st dropdown</p>

<pre><code>&lt;select name="fruit_name" id="fruit_name" style="font-family: Calibri;font-size: 10pt;" onchange="loadXMLDoc(this.value); "&gt;
   &lt;option value="0"&gt;-- please choose --&lt;/option&gt;
   &lt;option value="Pineapple"&gt;Pineapple&lt;/option&gt;
   &lt;option value="Apple"&gt;Apple&lt;/option&gt; 
</code></pre>

<p></p>

<p>//2nd dropdown
     

<pre><code>        $fruit_name = $_POST['fruit_name'];
#Connect to MySQL
#Connect to database

$result = mysql_query("SELECT colour FROM fruit WHERE fruit_name = '$fruit_name'");

echo "&lt;select name='colour' id='colour' style='font-family: Calibri;font-size: 10pt;'&gt;";

while($row = mysql_fetch_assoc($result))
{
echo "&lt;option value = ''&gt;" . $row['colour'] . "&lt;/option&gt;";
}
echo "&lt;/select&gt;";

mysql_free_result($result);

//Closes specified connection
?&gt;
</code></pre>

<p>form2.php</p>

<pre><code> &lt;?php
//connection

        $fruit_name = $_POST['fruit_name'];
        $colour = $_POST['colour'];
?&gt;
  &lt;label&gt;
  &lt;input type="text" name="fruit_name" id="fruit_name" value = "&lt;?php echo $fruit_name;?&gt;" readonly&gt;
  &lt;/label&gt;
  &lt;p&gt;
    &lt;label&gt;
    &lt;input type="text" name="colour" id="colour" value="&lt;?php echo $colour;?&gt;" readonly&gt;
    &lt;/label&gt;
  &lt;/p&gt;
</code></pre>
