Jump to content

Form is bringing back errors when its not ment to


Monk3h

Recommended Posts

When i fill out this form completly and click the Register image why does the error apear saying i havnt filled in a user name when i have? This should work.. It did work before, its just dosnt now and i dont know what iv done. Any help? =/

 

<?php include ("head.php"); ?>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<style type="text/css">
<!--
body {
background-color: #D1BFAB;
}
.style1 {
font-family: "Gill Sans MT";
color: #804040;
}
-->
</style></head>

<?php
Print"<form method=post action='register.php?action=register'>
<body><center>
<table width='755' height='482' border='0' cellpadding='0' cellspacing='0' bgcolor='#D1BFAB'>
  <tr>
    <td height='95' colspan='3' background='images/topimg.png'> </td>
  </tr>
  <tr>
    <td width='42' height='395' rowspan='2' background='images/leftimg.png'> </td>
    <td width='676' background='images/middleimg2.png'><img src='images/banner.png' width='676' height='100' /></td>
    <td width='42' rowspan='2' background='images/rightimg.png'> </td>
  </tr>
  <tr>
    <td height='184' background='images/middleimg2.png'><table width='679' border='0' cellpadding='0' cellspacing='0'>
      <tr>
        <td height='87' colspan='2'><p align='center' class='style1'><img src='images/rmessage.png' width='500' height='150'></p>          </td>
      </tr>
      <tr>
        <td width='96' height='22'><img src='images/ruser.png' width='150' height='20' /></td>
        <td width='583'><label>
          <input type='text' name='name'/>
        </label></td>
      </tr>
      <tr>
        <td><div align='left'><img src='images/remail.png' width='150' height='20' /></div></td>
        <td><input type='text' name='email' /></td>
      </tr>
      <tr>
        <td><div align='left'><img src='images/rpass.png' width='150' height='20' /></div></td>
        <td><input type='password' name='pass' /></td>
      </tr>
      <tr>
        <td><img src='images/rgender.png' width='150' height='20'></td>
        <td><label>
          <select name='gender'>
            <option>Male</option>
            <option>Female</option>
            </select>
        </label></td>
      </tr>
      <tr>
        <td height='34'><div align='left'><a href='index.php'><img src='images/back.png' width='150' height='20' border='0' /></a></div></td>
        <td><a href='register.php?action=register'><img src='images/signup.png' width='150' height='30' border='0' /></a></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td colspan='3'><img src='images/bottomimg.png' width='760' height='103' /></td>
  </tr>
</table>
</center></form>";

if ($action == register) {
if (!$name) {
	print "Please enter a User Name.";                                                                    // Line 73
	exit;
}
if (!$email) {
	print "Please enter an Email Address.";
	exit;

if (!$pass) {
	print "Please enter a Password.";
	exit;
}
}
$dupe1 = mysql_num_rows(mysql_query("select * from players where user='$user'"));
if ($dupe1 > 0) {
	print "Someone already has that username.";
	exit;
}
$dupe2 = mysql_num_rows(mysql_query("select * from players where email='$email'"));
if ($dupe2 > 0) {
	print "Someone already has that email.";
	exit;
}else{


mysql_query("insert into players (user, email, pass, gender) values('$user','$email','$pass','$gender')") or die("Could not register.");

print "You are now registered to play, $user.";
print "<br><a href=index.php>login</a>";
exit;
}}
?>
</body>

perhaps you (correctly) have globals turned off.  That would explain why php thinks the $name variable is not set.  change $name to $_POST['name'] and see what happens. (my guess is that it will throw "no e-mail address" error)

You're using an image as your submit button, but you can't do it your way:

 

<a href='register.php?action=register'><img src='images/signup.png' width='150' height='30' border='0' /></a>

 

That's just a hyperlink. No wonder no variables are going through. You need this as your submit button:

 

<input type='image' src='images/signup.png' width='150' height='30' border='0' />

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.