When a user logins in with the correct username and password my scirpt displays the correct info but when the edit it and press enter information the script is just send a constant steam of info to the database and not doing any thing.
Heres my scripts.
Login form
<html><head><title>Log-in Page</title><head>
<body>
Please enter your squad name and password to log-in here...
<form action="authenticate.php" method="post">
Squad Name:<br>
<input type="text" name="name">
<br><br>
Password:<br>
<input type="text" name="passworddb">
<br><br>
<input type="submit" value="Log In">
</form>
</body></html>
authenticate.php
<?php
require('variables.php');
?>
<?php
#if either form field is empty return to the log-in page
if ( (!$name) or (!$passworddb) )
{ header("Location:$HTTP_REFERER"); exit(); }
#conect to MySQL
$conn=@mysql_connect($databaseserver, $databaseuser, $databasepass)
or die("Could not connect");
#create the sql query
$rs=@mysql_select_db($databasename, $conn)
or die("Could not select to database");
$sql="SELECT * FROM $playerstable WHERE name = '$name' and passworddb = '$passworddb'";
#execute the query
$rs=mysql_query($sql, $conn)
or die("Could not execute query");
$num = mysql_numrows($rs);
?>
<?php
if ($submit) {
// process form
$db = mysql_connect($databaseserver, $databaseuser, $databasepass);
mysql_select_db($databasename,$db);
$sql = "UPDATE $playerstable SET wins = '$wins', mail = '$mail', url = '$url', icq = '$icq', aim = '$aim', country = '$country', losses = '$losses', totalwins = '$totalwins', totallosses = '$totallosses', points = '$points', totalpoints = '$totalpoints', games = '$games', totalgames = '$totalgames', penalties = '$penalties', streakwins = $streakwins, streaklosses = $streaklosses WHERE name='$edituser'";
$result = mysql_query($sql);
echo "Thank you! Information entered.<br><a href='$directory/index.php'>Return to Main</a>";
} else{
// display form
?>
<?php
$db = mysql_connect($databaseserver, $databaseuser, $databasepass);
mysql_select_db($databasename,$db);
$sortby = "name ASC";
$sql="SELECT * FROM $playerstable WHERE name = '$name'";
$result=mysql_query($sql,$db);
$row = mysql_fetch_array($result);
$mail = $row["mail"];
$url = $row["url"];
$icq = $row["icq"];
$aim = $row["aim"];
$country = $row["country"];
$bracket = $row["bracket"];
$penalties = $row["penalties"];
$wins = $row["wins"];
$losses = $row["losses"];
$points = $row["points"];
$total = $wins + $losses;
$totalwins = $row["totalwins"];
$totallosses = $row["totallosses"];
$totalpoints = $row["totalpoints"];
$games = $row["games"];
$totalgames = $row["totalgames"];
$streakwins = $row["streakwins"];
$streaklosses = $row["streaklosses"];
?>
<form method="post" action="<?php echo $PHP_SELF?>">
<center>
<table border="0" cellpadding="0" width="100%">
<tr>
<td width="12%"><br><b>General</b></td>
<td width="88%"> </td>
</tr>
<tr>
<td width="12%">
Name:</td>
<td width="88%"><input type="Text" name="name" value="<?php echo "$name" ?>"></td>
</tr>
<tr>
<td width="12%">
Mail:</td>
<td width="88%"><input type="Text" name="mail" value="<?php echo "$mail" ?>"></td>
</tr>
<tr>
<td width="12%">
Url:</td>
<td width="88%"><input type="Text" name="url" value="<?php echo "$url" ?>"></td>
</tr>
<tr>
<td width="12%">
ICQ:</td>
<td width="88%"><input type="Text" name="icq" value="<?php echo "$icq" ?>"></td>
</tr>
<tr>
<td width="12%">
Aim:</td>
<td width="88%"><input type="Text" name="aim" value="<?php echo "$aim" ?>"></td>
</tr>
<tr>
<td width="12%">
Country:</td>
<td width="88%"><select size="1" name="country">
<option selected><?php echo "$country" ?></option>
<option>No country</option>
<option>Argentina</option>
<option>Australia</option>
<option>Austria</option>
<option>Belgium</option>
<option>Bosnia</option>
<option>Brazil</option>
<option>Bulgaria</option>
<option>Canada</option>
<option>Chile</option>
<option>Croatia</option>
<option>Cyprus</option>
<option>Czechoslavakia</option>
<option>Denmark</option>
<option>England</option>
<option>Finland</option>
<option>France</option>
<option>Georgia</option>
<option>Germany</option>
<option>Greece</option>
<option>Holland</option>
<option>Hong Kong</option>
<option>Hungary</option>
<option>Iceland</option>
<option>India</option>
<option>Indonesia</option>
<option>Iran</option>
<option>Iraq</option>
<option>Ireland</option>
<option>Israel</option>
<option>Italy</option>
<option>Japan</option>
<option>Leichenstein</option>
<option>Luxembourg</option>
<option>Malaysia</option>
<option>Malta</option>
<option>Mexico</option>
<option>Morocco</option>
<option>New Zealand</option>
<option>North Vietnam</option>
<option>Norway</option>
<option>Poland</option>
<option>Portugal</option>
<option>Puerto Rico</option>
<option>Qatar</option>
<option>Rumania</option>
<option>Russia</option>
<option>Scotland</option>
<option>Singapore</option>
<option>South Africa</option>
<option>Spain</option>
<option>Sweden</option>
<option>Switzerland</option>
<option>Turkey</option>
<option>United Kingdom</option>
<option>United States</option>
</select></td>
</tr>
<tr>
<td width="12%"><br><b>Season</b></td>
<td width="88%"> </td>
</tr>
<tr>
<td width="12%">
Games (season):</td>
<td width="88%"><input type="Text" name="games" value="<?php echo "$games" ?>"></td>
</tr>
<tr>
<td width="12%">
Wins (season):</td>
<td width="88%"><input type="Text" name="wins" value="<?php echo "$wins" ?>"></td>
</tr>
<tr>
<td width="12%">
Losses (season):</td>
<td width="88%"><input type="Text" name="losses" value="<?php echo "$losses" ?>"></td>
</tr>
<tr>
<td width="12%">
Points (season):</td>
<td width="88%"><input type="Text" name="points" value="<?php echo "$points" ?>"></td>
</tr>
<tr>
<td width="12%">
Penalties (season):</td>
<td width="88%"><input type="Text" name="penalties" value="<?php echo "$penalties" ?>"></td>
</tr>
<tr>
<td width="12%"><br><b>Total</b></td>
<td width="88%"> </td>
</tr>
<tr>
<td width="12%">
Games (total):</td>
<td width="88%"><input type="Text" name="totalgames" value="<?php echo "$totalgames" ?>"></td>
</tr>
<tr>
<td width="12%">
Wins (total):</td>
<td width="88%"><input type="Text" name="totalwins" value="<?php echo "$totalwins" ?>"></td>
</tr>
<tr>
<td width="12%">
Losses (total):</td>
<td width="88%"><input type="Text" name="totallosses" value="<?php echo "$totallosses" ?>"></td>
</tr>
<tr>
<td width="12%">
Points (total):</td>
<td width="88%"><input type="Text" name="totalpoints" value="<?php echo "$totalpoints" ?>"></td>
</tr>
<tr>
<td width="12%"> </td>
<td width="88%"> </td>
</tr>
<tr>
<td width="12%">
Streak (wins):</td>
<td width="88%"><input type="Text" name="streakwins" value="<?php echo "$streakwins" ?>"></td>
</tr>
<tr>
<td width="12%">
Streak (losses):</td>
<td width="88%"><input type="Text" name="streaklosses" value="<?php echo "$streaklosses" ?>"></td>
</tr>
</table>
</center>
<p> <input type="Submit" name="submit" value="Enter information">
</form>
<?php
}
?>