title: Connecting HTML web page with mssql database
body: <p>I am trying to connect my html form to a database hosted through godaddy.com. I have the database with tables setup through SQL Server Management Studio and I have my html form made in Microsoft Visual Studio 2012. The SQL is connected to my godaddy account. What I cannot figure out is how to connect my form to the SQL. Is it something I can do with js or php or C#? I just need a basic example of how to connect it and I think I can figure it out. </p>
  
  <p>Here is my code.</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
      &lt;script type="text/javascript"&gt;
          function trim(tbx) { tbx.value = (tbx.value).trim(); }
          function done(){
              frm = document.LoginForm;
  
              var checkString = function(testChar, alpha, num, specialChars){
                  if(alpha!==true)alpha=false;
                  if(num!==true)num=false;
                  if(specialChars==null)specialChars="";
  
                  for(tc = 0; tc &lt; testChar.length;tc++){
                      var r = true;
                      if(!alpha &amp;&amp; testChar[tc].match(/^[a-z]+$/i)) return false;
                      if(!num &amp;&amp; testChar[tc].match(/^[0-9]+$/i)) return false;
  
                      if(!testChar[tc].match(/^[a-z0-9]+$/i) &amp;&amp; !checkSpecialChars(testChar[tc])) return false;
                  }
                  return true;
  
                  function checkSpecialChars(c){
                      for(sc = 0; sc &lt; specialChars.length;sc++){
                          if(specialChars[sc]==c){
                              return true;
                          }
                      }               
                      return false;
                  }
              }
  
              function test_name(name){
                  var t = name;
                  if (t.length&lt;2 || t.length&gt;35){
                      alert("Names must be between 2 and 35 letters.");
                      return false;
                  }
                  else {
                      if (!checkString(name,true,false,"'- ")){
                          alert("Names are made up of letters and sometime apostasies, dashes and spaces.");
                          return false;
                      }
                  }
                  return true;
              }
              function test_un(){
                  var t = frm.un.value;
  
                  if (t.length&lt;5 || t.length&gt;14){
                      alert("Usernames must be between 5 and 14 letters.");
                      return false;
                  }
                  else
                  for(i=0;i&lt;t.length;i++){
                      if (i==0){
                          if (!t[i].match(/^[a-z]+$/i)){
                              alert("Usernames must start with a letter.")
                              return false;
                          }
                      }
                      else if (!checkString(t[i],true,true,"_")){
                          alert("Usernames must be made up of letters, numbers and underscores.");
                          return false;
                      }
                  }
  
                  return true;
              }
              function test_pw(){
                  var t = frm.pw.value;
  
                  if (t.length&lt;7 || t.length&gt;14){
                      alert("Passwords must be between 7 and 14 letters.");
                      return false;
                  }
                  if (t!==frm.pc.value) {
                      alert("Your password and password confirmation do not match.")
                      return false;
                  }
                  for(i=0;i&lt;t.length;i++){
                      if (!checkString(t[i],true,true,"&gt;@!#$%^&amp;*()_+[]{}?:;|'\"\\,./~`-=")){
                          alert("Passwords must be made up of: \n  - at least one letter \n  - numbers \n  - any of the following: \n           &lt;&gt;@!#$%^&amp;*()_+[]{}?:;|'\"\\,./~`-=");
                          return false;
                      }
                  }
  
                  return true;
              }
  
              if (!test_name(frm.fn.value)){
                  frm.fn.focus();
                  frm.fn.select();
              }
              else if (!test_name(frm.ln.value)){
                  frm.ln.focus();
                  frm.ln.select();
              }
              else if (!test_un()){
                  frm.un.focus();
                  frm.un.select();
              }
              else if (!test_pw()){
                  frm.pw.focus();
                  frm.pw.select();
              }
              else{
                  alert(
                  "Name: " + frm.fn.value + " " + frm.ln.value + "\n" +
                  "Username: " + frm.un.value + "\n" +
                  "Password: " + frm.pw.value);
                  frm.fn.value = "";
                  frm.ln.value = "";
                  frm.un.value = "";
                  frm.pw.value = "";
                  frm.pc.value = "";
                  frm.fn.focus();
              }
          }
      &lt;/script&gt;
      &lt;title&gt;TEST&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;form name="LoginForm"&gt;&lt;table style="width:300px"&gt;
          &lt;table&gt;
              &lt;tr&gt;&lt;td&gt;First Name: &lt;/td&gt; &lt;td&gt;&lt;input type="text" name="fn" onblur="trim(document.LoginForm.fn);" /&gt;&lt;/td&gt;&lt;/tr&gt;
              &lt;tr&gt;&lt;td&gt;Last Name: &lt;/td&gt; &lt;td&gt;&lt;input type="text" name="ln" onblur="trim(document.LoginForm.ln);" /&gt;&lt;/td&gt;&lt;/tr&gt;
              &lt;tr&gt;&lt;td&gt;Username: &lt;/td&gt; &lt;td&gt;&lt;input type="text" name="un" onblur="trim(document.LoginForm.un);" /&gt;&lt;/td&gt;&lt;/tr&gt;
              &lt;tr&gt;&lt;td&gt;Password: &lt;/td&gt; &lt;td&gt;&lt;input type="password" name="pw" /&gt;&lt;/td&gt;&lt;/tr&gt;
              &lt;tr&gt;&lt;td&gt;Confirm: &lt;/td&gt; &lt;td&gt;&lt;input type="password" name="pc" /&gt;&lt;/td&gt;&lt;/tr&gt;
              &lt;tr&gt;&lt;td&gt;&lt;input type="Button" value="Submit!" onClick="done()" /&gt;&lt;/td&gt;&lt;/tr&gt;
          &lt;/table&gt;
      &lt;/form&gt;
      &lt;form name="UserList"&gt;
          &lt;table border="1px"&gt;
              &lt;thead&gt;
              &lt;tr&gt;
                  &lt;th&gt;ID&lt;/th&gt;
                  &lt;th&gt;First Name&lt;/th&gt;
                  &lt;th&gt;last Name&lt;/th&gt;
                  &lt;th&gt;Username&lt;/th&gt;
                  &lt;th&gt;Password&lt;/th&gt;
              &lt;/tr&gt;
              &lt;/thead&gt;
              &lt;tr&gt;
                  &lt;td&gt;&lt;/td&gt;
                  &lt;td&gt;&lt;/td&gt;
                  &lt;td&gt;&lt;/td&gt;
                  &lt;td&gt;&lt;/td&gt;
                  &lt;td&gt;&lt;/td&gt;
              &lt;/tr&gt;
          &lt;/table&gt;
          &lt;br /&gt;
      &lt;/form&gt;
  
      &lt;script type="text/javascript"&gt;
      &lt;/script&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p></p>