Beispiel #1
0
<html>
	<head>
		<title>修改用户</title>
		<meta charset='utf-8'/>
	</head>
<h1>修改用户</h1>
<?php 
require_once 'empService.class.php';
$id = $_GET['id'];
//创建一个service对象
$smpService = new EmpService();
//$arr = $smpService -> updateEmp($id);
$emp = $smpService->updateEmp($id);
?>
	<form action="empProcess.php" method="post">
		<table>
			<tr><td>id</td><td><input readonly="readonly" type="text" name="id" value="<?php 
echo $emp->getId();
?>
"/></td></tr>
			<tr><td>名字</td><td><input type="text" name="name"  value="<?php 
echo $emp->getName();
?>
"/></td></tr>
			<tr><td>级别</td><td><input type="text" name="grade" value="<?php 
echo $emp->getGrade();
?>
"/></td></tr>
			<tr><td>电邮</td><td><input type="text" name="email" value="<?php 
echo $emp->getEmail();
?>
Beispiel #2
0
      	$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){
          header("Location: ok.php");
          exit();
        }else{
          header("Location: err.php?ret=$ret");
          exit();
        }

      }

      
      	
    }

Beispiel #3
0
         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'];
         $email = $_POST['email'];
         //完成修改->数据库
         $res = $empService->updateEmp($id, $name, $grade, $email);
         if ($res == 1) {
             //成功!
             header("Location:ok.php");
             exit;
         } else {
             header("Location:error.php");
             exit;
         }
     } else {
         if ($flag == "addEmp") {
             //说明用户希望执行修改用户
             //接收数据$name=$_POST['name'];
             $id = $_POST['id'];
             $name = $_POST['name'];
             $grade = $_POST['grade'];