PHP Example
Screen shot
To Use of Switch Statement
<html>
<head>
<title>Switch Statement</title>
</head>
<body bgcolor=\"#FF9999\">
<form name=\"form\" method=\"post\" action=\"\">
<table border=\"1\">
<tr>
<td bgcolor=\"#00CC99\">Click any  train would u like for information</td>
</tr>
<tr>
<td><input type=\"radio\" name=\"train\" value=\"PATANA\" />PATANA EXPRESS</td>
</tr>
<tr>
<td><input type=\"radio\" name=\"train\" value=\"STABDI\" />SATABDI EXPRESS</td>
</tr>
<tr>
<td><input type=\"radio\" name=\"train\" value=\"AGRA\" />AGRA-MATHURA EXPRESS</td>
</tr>
<tr>
<td><input type=\"submit\" name=\"btn\" value=\"submit\" /></td>
</tr>
</table>
</form>
</body>
</html>
<?php
if(isset($_POST[\'btn\']))
{
$n=$_POST[\'train\'];
switch($n)
{
case \'PATANA\':
$tf=\"342\";
$dt=\"3.00am\";
$at=\"1.00pm\"
$ori=\"Bihar\";
break;
case \'STABDI\':
$tf=\"250\";
$dt=\"3.00am\";
$at=\"1.00pm\"
$ori=\"Newdelhi\";
break;
case \'AGRA\':
$tf=\"142\";
$dt=\"3.00am\";
$at=\"7.00pm\"
$ori=\"Mathura\";
break;
default:
echo \"No Select Any Train\";
}
?>
<table border=\"1\">
    <tr>
    <td width=\"90\" colspan=\"2\" bgcolor=\"#00CC99\">Shedule of Train</td>
     </tr>
  <tr>
    <td width=\"90\">Train Fare </td>
    <td width=\"94\"><?php echo $tf;  ?></td>
  </tr>
  <tr>
    <td>Dep. Time </td>
    <td><?php echo $dt; ?><br> </td>
  </tr>
  <tr>
    <td>Arr. Time </td>
    <td><?php echo $at; ?></td>
  </tr>
  <tr>
    <td>Orgin</td>
    <td><?php echo $ori; ?></td>
  </tr>
</table>
<?php
 }
?>

You can download source code here