title: using switch case login and new user registration in php
body: <p>I tried to work on with switch case login and newuser submit button, but i get only default case option with its values. and below is the code.</p>
  
  <pre><code>&lt;?php
      switch ($_POST['submit'])
      {
          //Customer Logins here 
          case "CLogin":
              $var1 = $_POST['cname'];
              $var2 = $_POST['cpwd'];
  
              $con1 = mysql_connect("localhost","FreeUser","123456");
              if(!$con1){
                  die('Could not Connect to mySql server : ' . mysql_error());
              }
              else
              {
                  mysql_select_db("ecommerce",$con1);
                  $r1 = mysql_query("select username,password from newusers where username='$var1' and         password='$var2'");
                  while($som = mysql_fetch_row($r1)){
                      $tn = $som[0];
                      $tp = $som[1];
                  }
  
                  if($tn == $var1 &amp;&amp; $tp == $var2)
                  {
                      session_start();
  
                      $_SESSION['LoggedUser']= $var1;
                  }
                  else{echo "Please check Username &amp; Password again!";}
              }
          break;
  
  
          //New Customer Sign up here
          case "CNewUser":
  
          break;
  
  
          //Wrong opotion code here
          default :
              echo "check out";
              echo $_POST['cuname'];
              echo $_POST['cpwd'];
              break;
      }
  ?&gt;
  
  &lt;form name="form1" method="post" &gt;
      &lt;table&gt;
          &lt;tr&gt;&lt;td&gt;User Id : &lt;/td&gt;&lt;td&gt;&lt;input type="text" name="cuname" /&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="cpwd" /&gt;&lt;/td&gt;&lt;/tr&gt;
          &lt;tr&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;input type="submit" name="CLogin" value="Sign In"&gt;&lt;input type="submit" name="CNewUser" value="New User"&gt;&lt;/td&gt;&lt;/tr&gt;
      &lt;/table&gt;
  &lt;/form&gt;
  </code></pre>