Witam, mam problem z formularzem.
Plik register.php
<form id="formID" class="formular" method="post" action="register/add_user.php" style="width:450px"> Rejestracja
<input value="" class="validate[required,custom[onlyLetterSp],maxSize[50],minSize[5]] text-input" type="text" name="rg_firstname" id="firstname" /> <input value="" class="validate[required,custom[onlyLetterNumber],maxSize[50],minSize[5]] text-input" type="text" name="rg_lastname" id="lastname" /> <input value="" class="validate[required,custom[email]] text-input" type="text" name="rg_email" id="email" /> <input value="" class="validate[required,custom[onlyLetterNumber],maxSize[32],minSize[3]] text-input" type="text" name="rg_login" id="login" /> <input value="" class="validate[required,custom[onlyLetterNumber],maxSize[45],minSize[5]] text-input" type="password" name="rg_password" id="password" /> <input value="" class="validate[required,equals[password]] text-input" type="password" name="rg_re_password" id="password" /> <input class="submit" type="submit" value="Zarejestruj"/> <input class="submit" type="reset" value="Wyczyść"/><hr/>
Plik add_user.php
$rg_login=$_POST['rg_login'];
$rg_password=$_POST['rg_password'];
$rg_re_password=$_POST['rg_re_password'];
$rg_name=$_POST['rg_name'];
$rg_lastname=$_POST['rg_lastname'];
$rg_email=$_POST['rg_email'];
include("../db_pass.php");
$query="SELECT * FROM account";
$i=0;
while ($i < $num) {
if($baza_rg_login == $rg_login){
echo 'Taki login już istnieje, wprowadź inny</br></br>'; echo '<form id="formID" class="formular" method="post" action="add_user.php" style="width:450px"> <fieldset>
<legend>
Rejestracja
</legend>
<label>
<span>*Imie: </span>
<input value="'.$rg_name.'" class="validate[required,custom[onlyLetterSp],maxSize[50],minSize[5]] text-input" type="text" name="rg_firstname" id="firstname" />
</label>
<label>
<span>*Nazwisko: </span>
<input value="'.$rg_lastname.'" class="validate[required,custom[onlyLetterNumber],maxSize[50],minSize[5]] text-input" type="text" name="rg_lastname" id="lastname" />
</label>
<label>
<span>*Email address: </span>
<input value="'.$rg_email.'" class="validate[required,custom[email]] text-input" type="text" name="rg_email" id="email" />
</label><br />
<label>
<span>*Login: </span>
<input value="" class="validate[required,custom[onlyLetterNumber],maxSize[32],minSize[3]] text-input" type="text" name="rg_login" id="login" />
</label>
<label>
<span>*Hasło: </span>
<input value="" class="validate[required,custom[onlyLetterNumber],maxSize[45],minSize[5]] text-input" type="password" name="rg_password" id="password" />
</label>
<label>
<span>*Potwierdź hasło: </span>
<input value="" class="validate[required,equals[password]] text-input" type="password" name="rg_re_password" id="password" />
</label>
</fieldset>
<input class="submit" type="submit" value="Zarejestruj"/><hr/>
</form>';
}else{
if($rg_password == $rg_re_password){
$sha1password=sha1($rg_password);
$query = "INSERT INTO account VALUES ('','$rg_login','$sha1password','$re_email','$rg_name','$rg_lastname')";
echo 'Konto zostało dodane możesz się zalogować</br>'; }else{
echo 'Hasła nie są takie same!</br></br>'; }
}
$i++;
}
Problem polega na tym że:
1. kiedy wcisnę przycisk zarejestruj, to plik add_user.php dodaje do tabeli puste rekordy.
2. po wciśnięciu zarejestruj, formularz nie przenosi do pliku add_user.php
Może Wy mi pomożecie, bo ja już nie wiem o co chodzi.
Ten post edytował przemo191 13.10.2011, 13:27:32