Проблем при регистрация

daemon666

Registered
Защо ми изписва само попълни всички полета???

<?php
include "config.php";
if ($_POST['submit']) {
$username= $_POST['username'];
$password = $_POST['password'];
$password2 = $_POST['password2'];
$email = $_POST['email'];
$country = $_POST['country'];
$fname = $_POST['fname'];
$lname = $_POST['lname'];
$age = $_POST['age'];
$sql = "SELECT * FROM users WHERE username = '$username'";
$result = mysql_query($sql) or die (mysql_error());
$broi = mysql_num_rows($result);
if ($username == NULL || $password == NULL || $password2 == NULL || $email == NULL || $fname == NULL || $lname == NULL || $age == NULL)
{
echo "Попълни всички полета.";
}
else {
if ($broi >= 1) {
echo "Това потребителско име е заето.";
}
else {
if ($password != $password2) {
echo "Паролоте не съвпадат!";
}
else {
$password = ($password);
if (!strstr("$email", "@") || !strstr("$email", ".")) {
echo "Невалиден email адрес.";
}
else {
$sql = "INSERT INTO users (username, password, email, country, fname, lname, age) VALUES ('$username', '$password', '$email', '$country', '$fname', '$lname', '$age')";
mysql_query($sql) or die (mysql_error());
echo "Поздравления! Вие се регистрирахте успешно.";
}
}
}
}
}
?>

Не мога да разбера къде е грешката...
 
<form method="post" action="">
<div id="username">
<span>*</span> Username<br />
<input type="text" name="username" style="width: 107px; height: 15px; border: 1px solid #4a79a7;" /><br />(6-18 знака)
</div>
<div id="mail">
<span>*</span> E-mail<br />
<input type="text" name="email" style="width: 107px; height: 15px; border: 1px solid #4a79a7;" />
</div>
<div id="pass">
<span>*</span> Password<br />
<input type="password" name="pass" style="width: 107px; height: 15px; border: 1px solid #4a79a7;" />
</div>
<div id="pass1">
<span>*</span> Repeat password<br />
<input type="password" name="pass" style="width: 107px; height: 15px; border: 1px solid #4a79a7;" />
</div>
<div id="name">
<span>*</span> First name<br />
<input type="text" name="fname" style="width: 107px; height: 15px; border: 1px solid #4a79a7;" />
</div>
<div id="lname">
<span>*</span> Last name<br />
<input type="text" name="lname" style="width: 107px; height: 15px; border: 1px solid #4a79a7;" />
</div>
<div id="country">
Country<br />
<input type="text" name="country" style="width: 107px; height: 15px; border: 1px solid #4a79a7;" />
</div>
<div id="age">
<span>*</span> Age<br />
<input type="text" name="age" style="width: 107px; height: 15px; border: 1px solid #4a79a7;" />
</div>
<div id="reg">
<input type="submit" name="submit" value="Регистрирай ме!" />
</div>
</form>
 
Промени формата така и опитай пак

<form method="post" action="">
<div id="username">
<span>*</span> Username<br />
<input type="text" name="username" style="width: 107px; height: 15px; border: 1px solid #4a79a7;" /><br />(6-18 знака)
</div>
<div id="mail">
<span>*</span> E-mail<br />
<input type="text" name="email" style="width: 107px; height: 15px; border: 1px solid #4a79a7;" />
</div>
<div id="pass">
<span>*</span> Password<br />
<input type="password" name="password" style="width: 107px; height: 15px; border: 1px solid #4a79a7;" />
</div>
<div id="pass1">
<span>*</span> Repeat password<br />
<input type="password" name="password2" style="width: 107px; height: 15px; border: 1px solid #4a79a7;" />
</div>
<div id="name">
<span>*</span> First name<br />
<input type="text" name="fname" style="width: 107px; height: 15px; border: 1px solid #4a79a7;" />
</div>
<div id="lname">
<span>*</span> Last name<br />
<input type="text" name="lname" style="width: 107px; height: 15px; border: 1px solid #4a79a7;" />
</div>
<div id="country">
Country<br />
<input type="text" name="country" style="width: 107px; height: 15px; border: 1px solid #4a79a7;" />
</div>
<div id="age">
<span>*</span> Age<br />
<input type="text" name="age" style="width: 107px; height: 15px; border: 1px solid #4a79a7;" />
</div>
<div id="reg">
<input type="submit" name="submit" value="Регистрирай ме!" />
</div>
</form>
 
$password = $_POST['password'];

Писал си PASS в формата.

А, не съм видял, че вече е отговорено. :)
 

Back
Горе