Javascript not acquiring field value
<p>I have 2 php pages, htmldisp.php and classfn.php. And an alert used in hrmldisp.php is not working. It should actually give a dropdown value.</p>

<p>htmldisp.php is</p>

<pre><code> &lt;?php include("classfn.php"); $obj=new hello;?&gt; 
 &lt;script language="javascript"&gt;
  function submitted(){
   var select=document.getElementById('newdrop').value; 
  alert(select);    
 }
 &lt;/script&gt;

&lt;?php 
$id="newdrop";
echo $obj-&gt;hellofn($id); ?&gt;
&lt;input type="submit" onclick="submitted();"
</code></pre>

<p>classfn.php is</p>

<pre><code>   &lt;?php
   class hello{
function hellofn($id){  

    $s="select `Name`,`Value` from `Days`;
    $q=mysql_query($s);
    $p='&lt;td&gt;'.'&lt;select id="$id"&gt;';
            while($re=mysql_fetch_array($q)){ 
            $value=$re["Value"];
            $name=$re["Name"];
            $p.='&lt;option value="' . $value . '"' . ( $selected==$value ? ' selected="selected"' : '' ) . '&gt;' . $name . '&lt;/option&gt;';
            }
    $p.='&lt;/select&gt;'.'&lt;/td&gt;';

    return $p;
    } 
           ?&gt;
</code></pre>

<p>The problem is alert(select) not working. Thanks</p>
