JavaScript Problem

Hi, I am extremely new to Javascript and have stumbled along a validation problem. My form is below:

<form name=“validate” action=“<?php echo $pfile;?>” onsubmit=“return Validate()” method=“post”>
<input type=“hidden” name=“patientid” id=“drugnames” value=“<?php echo $patientid;?>” />



   $currentdrug = $_SESSION['prescribed'];

	
    $sql    = 'SELECT * FROM `Drug` ';
    $result = mysql_query($sql);



    if (mysql_num_rows($result) == 0)
        echo " -- No patients found -- ";
    else {
        echo "&lt;select name=\\"drugid\\"&gt;/n";
		
        echo "&lt;option value=\\"\\"&gt; &lt;/option&gt;\
";
        while ($r = mysql_fetch_array($result, MYSQL_ASSOC))
            echo "&lt;option value=\\"" . $r['ref'] . "\\"&gt;" . $r['ref'] . " : " . $r['name'] . " " . $r['dose'] . "&lt;/option&gt;\
";

        echo "&lt;/select&gt;\
";
    }

	


?&gt;



So basically the php script runs through every drug id and prints out the ref number, name and dose in a option value form. The variable $currentdrug produces a number. This is where my problem lies. I have created a JS function like so:

  &lt;script&gt;
	function Validate() {
	
	valid = true;
	var previous = document.getElementById('currentdrug').value;

    if ( document.validate.drugid.selectedIndex == 1 && document.validate.previous.value == 5  )
    {
        alert ( "Big Drop" );
        valid = false;
    }

		return true;
	}
  &lt;/script&gt;

I am trying to say, if the selected index is 1 and the current drug is equal to 5, an alert is produced, but having no success with this function. any idea on how to amend this? Thanks in advance!