Как сделал таблицу:
CREATE TABLE `users` (`id` smallint(8) unsigned NOT NULL auto_increment,
`login` varchar(50) NOT NULL default '',
`password` varchar(32) NOT NULL default '',
`name` text(10000) NOT NULL default '',
`lastName` text(10000) NOT NULL default '',
`teacher` text(10000) NOT NULL default '',
`address` text(10000) NOT NULL default '',
`phone` text(10000) NOT NULL default '',
PRIMARY KEY (`id`),
UNIQUE KEY `login` (`login`)
) TYPE=MyISAM AUTO_INCREMENT=2 ;
Вот сама страничка с регистрацией:
<?php mysql_connect("localhost","root","");
mysql_select_db("olimp");
?>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
<title>Регистрация</title>
<style>
#area {
position:absolute;
left:170px;
}
</style>
</head>
<body>
<form action="register.php" method="post"><br />
<p>Логин (E-mail)<input name="login" type="text" id="area"></p>
<p>Пароль<input name="password" type="password" id="area" value=""></p>
<p>Имя<input name="name" type="text" id="area"></p>
<p>Фамилия<input name="lastName" type="text" id="area"></p>
<p>ФИО преподавателя<input name="teacher" type="text" id="area"></p>
<p>Домашний адрес<textarea name="address" cols="" rows="" id="area"></textarea></p>
<p>Телефон<input name="phone" type="text" id="area"></p>
<p><input type="submit" value="Регистрация" /></p>
</form>
<?
if(isset($_POST['login']) && isset($_POST['password']) && isset($_POST['name']) && isset($_POST['lastName']) && isset($_POST['teacher']) && isset($_POST['address']) && isset($_POST['phone'])) {
$login = $_POST['login'];
$password = $_POST['password'];
$name = $_POST['name'];
$lastName = $_POST['lastName'];
$teacher = $_POST['teacher'];
$address = $_POST['address'];
$phone = $_POST['phone'];
if($login == '' || $password == '' || $name == '' || $lastName == '' || $teacher == '' || $address == '' || $phone == '') {
echo "заполнены не все поля"; }
else {
$quer = mysql_query("INSERT INTO `users` ('login','password','name','lastName','teacher','address','phone') VALUES ($login,$password,$name,$lastName,$teacher,$address,$phone)");
echo "OK!";
}
} else { echo "заполнены не все поля"; }
?>
</body>
</html>