Problem with Reguser codes!

Place for questions and answers for all newcomers and new coders. This is a free for all forum, no question is too stupid and to noob.
Post Reply
Syppii
Posts: 11
Joined: Fri Jul 27, 2012 4:59 pm

Problem with Reguser codes!

Post by Syppii »

I am experiencing problems with my reguser.php codes! Whenever I submit my, name, password and email it just says 'you did not enter a password' even though I have. But it also comes up with this '

( ! ) Notice: Undefined index: password in C:\wamp\www\Tutorial\reguser.php on line 7
Call Stack
# Time Memory Function Location
1 0.0009 696032 {main}( ) ..\reguser.php:0

( ! ) Notice: Undefined index: pass2 in C:\wamp\www\Tutorial\reguser.php on line 8
Call Stack
# Time Memory Function Location
1 0.0009 696032 {main}( ) ..\reguser.php:0

( ! ) Notice: Undefined index: password in C:\wamp\www\Tutorial\reguser.php on line 25
Call Stack
# Time Memory Function Location
1 0.0009 696032 {main}( ) ..\reguser.php:0
You didn't enter a password!
Go back!'

I am really not sure what to do!I have entered my codes below!

Code: Select all

<?php
include 'connect.php';
?>

<?php
$player=$_POST['player'];
$password=$_POST['password'];
$pass2=$_POST['pass2'];
$player=strip_tags($player);
$email=$_POST['email'];
$email=strip_tags($email);

if ($email == "")
{
print "You didn't enter a email address!<br>";
print " <a href='register.php'>Go back</a>";
exit;
}
if ($password==$pass2)
{
$isplayer="SELECT * from players where name='$player'";
$isplayer2=mysql_query($isplayer) or die("Could not query player's table.");
$isplayer3=mysql_fetch_array($isplayer2);

if(!$_POST['password'] || !$_POST['pass2'])
{
print "You didn't enter a password!<br>";
print " <a href='register.php'>Go back</a>";
exit;
}
else if($isplayer3 || strlen($player)>21 || strlen($player)<1)
{
print "There is already a player with that name or the name you specified is over 21 leters or less that 1 letter<br>";
print " <a href='register.php'>Go back</a>";
exit;
}
else
{
$isaddress="SELECT * from players where email='$email'";
$isaddress2=mysql_query($isaddress) or die("not able to query for password");
$isaddress3=mysql_fetch_array($isaddress2);
if ($isaddress3)
{
print "There is already a player with that email address.<br>";
print " <a href='register.php'>Go back</a>";
exit;
}
else
{
$password=md5 ($password);

$SQL = "INSERT into players(name, password, email, level, exper) VALUES ('$player','$password','$email','1','0')";
mysql_query($SQL) or die("could not register");

print "Thank you for registering!";
}
}
}

else
{
print "Your password didn't match or you did not enter a password.<br>";
print " <a href='register.php'>Go back</a>";
exit;
}
print " <a href='login.php'>Login Page</a><br>";

?>


User avatar
OldRod
Posts: 1320
Joined: Sun Sep 20, 2009 4:26 pm

Re: Problem with Reguser codes!

Post by OldRod »

Those error messages make me think you didn't name the form fields 'password' and 'pass2'.

Post the HTML from your form page please.
Syppii
Posts: 11
Joined: Fri Jul 27, 2012 4:59 pm

Re: Problem with Reguser codes!

Post by Syppii »

Code: Select all

<?php
include 'connect.php';

?>

<form method ="post" action="reguser.php">
Type Username Here: <input type="text" name="player" size="21">
<br>
Type Password Here: <input type="text" name="passsword" size="15">
<br>
ReType Password Again: <input type="text" name="passs2" size="15">
<br>
Type Email Address: <input type="text" name="email" size="60">
<br>
<input type="submit" value="submit">
User avatar
OldRod
Posts: 1320
Joined: Sun Sep 20, 2009 4:26 pm

Re: Problem with Reguser codes!

Post by OldRod »

Change passsword to password and passs2 to pass2
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: Problem with Reguser codes!

Post by Jackolantern »

Yep, 1 too many "s" in each of those :)
The indelible lord of tl;dr
Post Reply

Return to “Beginner Help and Support”