BCA Practical 12

Practical 12 : Write a PHP program which is execute SWITCH statement
<html>

  <head>

  <title>Practical : 12</title>

  </head>

  <body>
<?php 
 $no='';

  

  if(isset($_POST['ok']))

  {

  $no = $_POST['t1'];

  switch($no)

  {

  case 1 :

  echo "<h2>Number 1</h2>";

  break;

  case 2 :

  echo "<h2>Number 2</h2>";

  break;

  case 3 :

  echo "<h2>Number 3</h2>";

  break;

  default :

  echo "<h2>Enter Only 1 To 3 Number.</h2>";

  break;

  } 

  }

  ?>

  <center>

  <form name="f1" method="post">

  <table>
<tr>

  <td>

  <input type="text" name="t1" value="<?php echo $no; ?>">

  <input type="submit" name="ok" value="Click Me">

  </td>

  </tr>

  </table>

  </form>

  </center>

  </body>

  </html>


EmoticonEmoticon