

<html>
<head><title>Workflow System</title></head>
<body>
<h1>Register for an Account:</h1>
<form action="registration_action.php" method="POST">
Username: <input type="text" name="name" /><br />
Email: <input type="text" name="email" /><br />
Password: <input type="password" name="pword[]" /><br />
Password (again): <input type="password" name="pword[]" /><br />
<input type="submit" value="GO" />
</form>
</body>
</html>


<html>
<body>
<p>You entered:</p>
<?php
//$username = $_POST['name'];
//$password = $_POST['pword'];
//echo "<p>Username = " . $username . "</p>";
//echo "<p>Password[1] = " . $password[0] . "</p>";
//echo "<p>Password[2] = " . $password[1] . "</p>";
function validate($allSubmitted){
$message = "";
$passwords = $allSubmitted['pword'];
$firstPass = $password[0];
$secondPass = $password[1];
$username = $allSubmitted['name'];
echo "<p>Username = " . $username . "</p>";
echo "<p>Password[1] = " . $firstPass . "</p>";
echo "<p>Password[2] = " . $secondPass . "</p>";
if ($firstPass != $secondPass) {
$message = $message."Passwords don't match<br />";
}
if (strlen($username) < 5 || strlen($username) > 50){
$message = $message."Username must be between 5 and 50 characters<br />";
}
if ($message == ""){
$message = "OK";
}
return $message;
}
if (validate($_POST) == "OK") {
echo "<p>Thank you for registering!</p>";
} else {
echo "<p>There was a problem with your registration:</p>";
echo validate($_POST);
echo "<p>Please try again.</p>";
}
?>
</body>
</html>
在registration_action.php当中
$firstPass = $password[0];
$secondPass = $password[1]; 没有找到数据;
二、页面表单录入数据库
该表单也是和上面的fixed.php中差不多,多出部分是della表单中的元素;


1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22



1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

1.函数 db_connect 当中的$user='root',$password='zdndd', $db='shop' 都是我phpmyadmin中的用户名、密码、shop数据库;
2.$sql = "insert into della (name, address, school, id, birthday, msn, intruduction) values della是一个数据库表,本来这里不是della的,不写肯定是要报错的了,还要我够聪明看到了phpmyadmin当中的SQL语言,哇哈哈!搞定!