Witam, mam sprawnie działający skrypt .php, wypełniamy formularz i dopiero po wypełnieniu wszystkich pól i sprawdzeniu poprawności chciałbym aby przeniosło mnie na następną stronę przy zachowaniu wartości zmiennych. Oto kod:
plik pierwszy o nazwie
registro.php:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title> Rejestracja (Krok 1)</title>
<link rel="stylesheet" href="css/style.css" type="text/css" media="all" />
<script src="js/jquery-1.3.2.min.js" type="text/javascript"></script>
<script src="js/fns.js" type="text/javascript"></script>
</head>
<body>
<div id="wrapper">
<div id="page">
<div id="header">
<div class="shell">
<div id="logo">
<h1><a href="index.php">MOJA STRONA</a><span class="description">Centrum Zarządzania Postacią</span></h1>
</div>
</div>
</div>
<center>
<h2>Rejestracja - Krok 1</h2>
<br>
<form method = "post" action = "">
Imie_Nazwisko:<br><input type = "text" name = "nome"><br><br>
Hasło:<br><input type = "password" name = "senha"><br><br>
Powtórz hasło:<br><input type = "password" name = "senha2"><br><br>
Adres E-mail:<br><input type = "text" name = "email"><br><br>
Wybierz swoją płeć:<br>
<input type = "radio" name = "plec" value = "kobieta" checked = ""/><b> Kobieta   </b><br>
<input type = "radio" name = "plec" value = "mezczyzna"/><b> Mężczyzna</b><br>
<input type = "submit" name = "registrar" value = "Następny krok">
</center>
</form>
<br>
<br>
<font color="red"><b>
<?php
if(isset($_POST['registrar'])) {
if(IsValidName($_POST['nome']))
{
include('config.php');
if(!$rows)
{
if(strlen($_POST['senha']) >= 6
&& strlen($_POST['senha']) <= 20
) {
if($_POST['senha'] == $_POST['senha2'])
{
if((strlen($_POST['email']) >= 7
) && (strstr($_POST['email'],"@")) && (strstr($_POST['email'],".")) ) {
if(!$rows2)
{
header('location: registro2.php'); }
else
{
echo "<center>BŁĄD: Ten adres E-mail jest już zajęty!</center>"; }
}
else echo "<center>BŁĄD: Niepoprawny adres E-mail!</center>"; }
else echo "<center>BŁĄD: Podane hasła nie są jednakowe!</center>"; }
else echo "<center>BŁĄD: Niepoprawny format hasła! Hasło musi zawierać od 6 do 28 znaków!</center>"; }
else echo "<center>BŁĄD: Ten nick jest już zarejestrowany w bazie danych! Wybierz inny nick!</center>"; }
else
{
echo "<center>BŁĄD: Niepoprawny format nicku postaci! Nick musi zawierać od 5 do 24 liter!       </center>"; echo "<center>BŁĄD: Musi on przybrać formę Imie_Nazwisko, nie może zawierać znaków specjalnych!</center>"; echo "<center>BŁĄD: Przykład poprawnego nicku: Jan_Kowalski , proszę podać poprawny nick!    </center>"; }
}
function IsValidName($n)
{
if($len < 5 || $len > 24)
return 0;
if($n[$len - 1] == '_' || $n[0] == '_')
return 0;
$underlines = 0;
for($i = 0; $i != $len; ++$i)
{
if($n[$i] == '_')
{
++$underlines;
}
}
return $underlines == 1;
}
?>
</b></font>
</div>
<div class="cl"> </div>
</div>
<div class="cl"> </div>
<div id="footer">
<div class="shell">
<p class="copy">©moja strona kox!</p>
</div>
</div>
</body>
</html>
plik drugi o nazwie
registro2.php:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title> Rejestracja (Krok 2)</title>
<link rel="stylesheet" href="css/style.css" type="text/css" media="all" />
<script src="js/jquery-1.3.2.min.js" type="text/javascript"></script>
<script src="js/fns.js" type="text/javascript"></script>
</head>
<body>
<div id="wrapper">
<div id="page">
<div id="header">
<div class="shell">
<div id="logo">
<h1><a href="index.php">Moja strona</a><span class="description">Centrum Zarządzania Postacią</span></h1>
</div>
</div>
</div>
<center>
<h2>Rejestracja - Krok 2</h2>
<br>
Nazwa Postaci:
<?php echo $_POST['nome']?><br>
Hasło:
<?php echo $_POST['senha']?><br>
Adres E-mail:
<?php echo $_POST['email']?><br>
Płeć: <?php
switch($_POST['plec'])
{
case "kobieta":
break;
case "mezczyzna":
break;
}
?>
</center>
</div>
<div class="cl"> </div>
</div>
<div class="cl"> </div>
<div id="footer">
<div class="shell">
<p class="copy">©Moja strona kox!</p>
</div>
</div>
</body>
</html>
Oto treść problemu:
(IMG:
http://iv.pl/images/70340332124584261712.png)
Przy takim rozwiązaniu, przenosi człowieka bez wartości zmiennych. Proszę o pomoc.
Ten post edytował Aprill 6.08.2012, 13:57:58