Using selected options value before clicking submit
<pre><code>&lt;form id="form1" name="form1" method="post" action=""&gt;
&lt;select name="apartment_type" id="abc" &gt;
      &lt;option value=""&gt;Please Select Apartment type&lt;/option&gt; 
      &lt;option value="duplex"&gt;Duplex&lt;/option&gt;
      &lt;option value="bongalow"&gt;Bongalow&lt;/option&gt;
      &lt;option value="flats"&gt;Flats&lt;/option&gt;
      &lt;/select&gt;
&lt;?php
      $ijk = $_POST['apartment_type'];
      echo $ijk; // This doesn't appear until I submit the form
?&gt;
&lt;input type="submit" name="button"/&gt;
&lt;/form&gt;
</code></pre>

<p>I have a little problem here for this application am building for a real Estate firm. Is there a way I can get the <code>$ijk</code> variable out before I submit the form? I included this JavaScript function:</p>

<pre><code>$(document).ready(function() {
var type
$('#abc').change(function() {
    var type = $('#abc').attr('value');
    alert (type);
}
}
</code></pre>

<p>The selected option is shown, but i cant seem to find a way around it with my PHP code      </p>
