Javascript alert if value is empty and delete confirmation if it isn't
<p>I have a form that deletes a a value once the user has confirmed the action via a javascript confirm.  This works well but I would also like the script to alert the user if the value was empty therefore stopping the script from running altogether.</p>

<pre><code>&lt;script&gt;
function delete_confirm() {
    var msg = confirm('Are you sure you want to delete the selected audit');
    if(msg == false) {
        return false;
    }
}
&lt;/script&gt;


&lt;form id="audit_control_form" method="post" action="&lt;?php echo $_SERVER['PHP_SELF']; ?&gt;"&gt;
            &lt;select id="audit_id_select" name="audit_id_select" style="width:150px"&gt;
                &lt;option value=""&gt;Please select&lt;/option&gt;
               &lt;? while($row = mysqli_fetch_assoc($result)){
                    if($row['dateEnd'] == '0000-00-00'){
                        $dateEnd = 'Present';
                    }else{
                        $dateEnd = date('d-m-Y', strtotime($row['dateEnd']));
                    }
                    echo '&lt;option value="'.$row['auditID'].'"&gt;'.$row['auditName'].' ('.date('d-m-Y', strtotime($row['dateStart'])).' - '.$dateEnd.')&lt;/option&gt;';}?&gt;
            &lt;/select&gt;
          &lt;input type="submit" name="audit_delete_submit" onClick="return delete_confirm()" value="Delete" /&gt;
        &lt;/form&gt;
</code></pre>

<p>I am not sure what is the best way to implement this (I'm fairly new to javascript)</p>

<p>Thanks</p>
