function call in PHP or JS
<p>Actually I want to validate username nd password only for my <code>os1 == 2</code> which is linux so please help me</p>

<pre><code>if (os1 == 1) os = "Windows";

if (os1 == 2) os = "Linux";
if (os1 == 3) os = "Others";


function Validate() {

var dropdownIndex = document.getElementById('type').selectedIndex;
var sztype = document.getElementById('type')[dropdownIndex].value;

if (sztype == "1") {
    var szpassword = "";
    var szguid = "";
    var name = Trim(document.userform.name.value);

    var ip = Trim(document.userform.ip.value);
    if (ip.length == 0) {
        alert("Please specify IP/Host Name.");
        return false;
    }
    if (name.length == 0) {
        name = ip;
    }

    szusername = Trim(document.userform.username.value);

    if (szusername.length == 0) {
        alert("Please specify Username.");
        return false;
    }

    var szvalidchars = new RegExp("[~!@#$%^&amp;*()+|{}:\"&lt;&gt;?,/;'=\\`]");
    if (szvalidchars.test(szusername)) {
        alert("Username cannot contain invalid characters.");
        return false;
    }

    szpassword = Trim(document.userform.password.value);
    if (szpassword.length == 0) {
        alert("Please specify Password.");
        return false;
    }
</code></pre>

<p>and I have a table like this</p>

<pre><code>&lt;form name="userform"&gt;
&lt;table cellpadding="10" cellspacing="0" border="0" width="100%"&gt;
&lt;tr&gt;
    &lt;td&gt;&lt;table width="100%" cellpadding="0" cellspacing="0"&gt;
        &lt;tr&gt;
          &lt;td style="padding-left:12px; padding-top:10px;  font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px;"&gt;To add single/multipe physical server(s), enter the IP address/range of physical server(s).&lt;/td&gt;
        &lt;/tr&gt;
      &lt;/table&gt;&lt;/td&gt;
  &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;&lt;/br&gt;
    &lt;table border=0&gt; 
    &lt;tr&gt;
        &lt;td style="padding-left:20px; padding-top:5px; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px;"&gt;Type: &lt;/td&gt;
        &lt;td style="padding-top:5px; padding-left:50px;"&gt;
        &lt;select name="type" id="type" class="SelectList Width200" onchange="OnCbTpyeChange()"&gt;
        &lt;?php
        foreach($type as $key =&gt; $value)
        {
            echo  "&lt;option value=\"".$key."\"";
            echo"&gt;";
            echo $value;
            echo "&lt;/option&gt;";
        }
        ?&gt;
        &lt;/select&gt;
        &lt;/td&gt;
    &lt;/tr&gt;
    &lt;/table&gt;
    &lt;table id="hostname_table" name="hostname_table" border=0&gt;
    &lt;tr&gt;
        &lt;td style="padding-left:20px; padding-top:10px; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px;"&gt;Name: &lt;/td&gt;
        &lt;td style="padding-top:10px;"&gt;
        &lt;input name="name" type="text" maxlength="50" &gt;
        &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td style="padding-left:20px; padding-top:10px; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px;"&gt;IP/Host Name: &lt;/td&gt;
        &lt;td style="padding-top:10px;"&gt;
        &lt;input name="ip" type="text" maxlength="50" &gt;
        &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td style="padding-left:20px; padding-top:10px; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px;"&gt;User Name: &lt;/td&gt;
        &lt;td style="padding-top:10px;"&gt;
        &lt;input name="username" type="text" maxlength="50" &gt;
        &lt;/td&gt;

    &lt;tr&gt;
        &lt;td style="padding-left:20px; padding-top:10px; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px;"&gt;Password: &lt;/td&gt;
        &lt;td style="padding-top:10px;"&gt;
        &lt;input type="password" name="password" type="text" maxlength="50"&gt;
        &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td style="padding-left:20px; padding-top:10px; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px;"&gt;OS: &lt;/td&gt;
        &lt;td style="padding-top:10px;"&gt;
        &lt;select name="os" id="os" class="SelectList Width200"&gt;
        &lt;?php
        foreach($ostype as $key =&gt; $value)
        {
            echo  "&lt;option value=\"".$key."\"";

            echo"&gt;";
            echo $value;
            echo "&lt;/option&gt;";
        }
        ?&gt;
        &lt;/select&gt;
        &lt;/td&gt;
    &lt;/tr&gt;
    &lt;/table&gt;
    &lt;table id="nwrange_table" name="nwrange_table" style="display:none"&gt;

        &lt;tr&gt;
            &lt;td style="padding-left:20px; padding-top:10px; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px;"&gt;Start IP Address: &lt;/td&gt;
            &lt;td style="padding-top:10px;"&gt;
            &lt;input name="startip" type="text" maxlength="50" id='startip'&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td style="padding-left:20px; padding-top:10px; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px;"&gt;End IP Address: &lt;/td&gt;
            &lt;td style="padding-top:10px;"&gt;
            &lt;input name="endip" type="text" maxlength="50" id='endip'&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
    &lt;/table&gt;


    &lt;/td&gt;
    &lt;/tr&gt;
</code></pre>

<p></p>

<p>


  
    
       
        
        
        
        
      
    
  


</p>
