Learning PHP and MySQL

Example 04-12 Using the DEFAULT: statement to generate an error

<?php
switch  ($action)  {
case  "ADD":
  echo  
"Perform  actions  for  adding.";
  break;
case  
"MODIFY":
  echo  
"Perform  actions  for  modifying.";
  break;
case  
"DELETE":
  echo  
"Perform  actions  for  deleting.";
  break;
default:
  echo  
"Error:  Action  must  be  either  ADD,  MODIFY,  or  DELETE.";
}
?>

Posted by on 08/03 at 08:14 AM

Next entry: Example 04-13 Using endswitch to end the switch definition

Previous entry: Example 04-11 What happens when there are no break keywords

<< Back to main