Exemple #1
0
      if($flag=="del"){
      	$id=$_REQUEST['id'];
      	if($empService->delEmpById($id)==1){
	      	header("Location: ok.php?ret=$ret");
	      	exit();
	      }else{
	        header("Location: err.php?ret=$ret");
	      	exit();
	      }
      }else if($flag=="addemp"){
      	$name=$_POST['name'];
      	$grade=$_POST['grade'];
      	$email=$_POST['email'];
      	$salary=$_POST['salary'];
      	$res=$empService->addEmp($name,$grade,$email,$salary);
      	if($res==1){
      		header("Location: ok.php");
      		exit();
	      }else{
	        header("Location: err.php?ret=$ret");
	      	exit();
	      }
      }else if($flag=="updateemp"){
        $id=$_POST['id'];
        $name=$_POST['name'];
        $grade=$_POST['grade'];
        $email=$_POST['email'];
        $salary=$_POST['salary'];
        $res=$empService->updateEmp($id,$name,$grade,$email,$salary);
        if($res==1){
Exemple #2
0
         header("Location:ok.php");
         exit;
     } else {
         header("Location:error.php");
         exit;
     }
 } else {
     if ($flag == "addemp") {
         //说明用户希望执行添加用户
         //接收数据
         $id = $_POST['id'];
         $name = $_POST['name'];
         $grade = $_POST['grade'];
         $email = $_POST['email'];
         //完成添加->数据
         $res = $empService->addEmp($id, $name, $grade, $email);
         if ($res == 1) {
             //成功!
             header("Location:ok.php");
             exit;
         } else {
             header("Location:error.php");
             exit;
         }
     } else {
         if ($flag == "updateemp") {
             //说明用户希望执行修改用户
             //接收数据$name=$_POST['name'];
             $id = $_POST['id'];
             $name = $_POST['name'];
             $grade = $_POST['grade'];