I'm trying to make this pointsystem for a golfclub. Every sunday 8 players play a round of golf and achive points for a ranking list! Now, I have a form where I insert the points looking like this:
<form id="form1" name="form1" method="post" action="oom_aprove.php">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="30" valign="top">Name</td>
<td valign="top"><div align="center">Placement</div></td>
<td valign="top"><div align="center">Point</div></td>
</tr>
<tr>
<td>Peter Jacobsen
<input name="peterid" type="hidden" id="peterid" value="1"></td>
<td width="100">
<div align="center">
<input name="peterpla" type="text" size="5" class="form1"/>
</div></td>
<td width="50">
<div align="center">
<input name="peterpoint" type="text" size="5" value="0" class="form1"/>
</div></td>
</tr>
<tr>
<td>Rico Dallgreen
<input name="ricoid" type="hidden" id="ricoid" value="2"></td>
<td>
<div align="center">
<input name="ricopla" type="text" size="5" class="form1"/>
</div></td>
<td>
<div align="center">
<input name="ricopoint" type="text" size="5" value="0" class="form1"/>
</div></td>
</tr>
------------- etc. etc.
<tr>
<td>Mark Howard
<input name="markid" type="hidden" id="markid" value="8"></td>
<td>
<div align="center">
<input name="markpla" type="text" size="5" class="form1"/>
</div></td>
<td>
<div align="center">
<input name="markpoint" type="text" size="5" value="0" class="form1"/>
</div></td>
</tr>
</table></td>
</tr>
<tr>
<td><input type="submit" name="Submit" value="Submit"></td>
</tr>
</table>
</form>
Then when I submit I go to this script:
$pjpoints=intval($_POST['peterpoint']);
$rdpoints=intval($_POST['ricopoint']);
$mhpoints=intval($_POST['markpoint']);
$query="UPDATE cms_orderofmerit_2007 SET Point = Point + $pjpoints WHERE ID = 1";
mysql_query($query);
$query="UPDATE cms_orderofmerit_2007 SET Point = Point + $rdpoints WHERE ID = 2";
mysql_query($query);
//Player 3 to 7 here
$query="UPDATE cms_orderofmerit_2007 SET Point = Point + $mhpoints WHERE ID = 8";
mysql_query($query);
if(!mysql_query($query)){
print "Error Occurred:". mysql_error() ;
exit();
}
echo $query;
echo "Order of Merit updated...";
mysql_close();
Now... something goes wrong cause if I by example gives every player 10 point then 6 players gets 10 point, 1 player 20 point and the last player 0 point. Can somebody please help me and see my wrong or mayby there is a easier way to do this?