how 2 call counter 2 have a limit

wxdqz

New Member
Hi...

im creating a football website and in order to register a person has to pick 11 players from premiership teams!
i want there to be a limit of 50 million for the 11 players! at the moment i have a counter which count how much each player adds up as they pick them..
now when they press submit button.. its goes to savadata.php which will check it and then insert it to database

any ideas how to check the counter and if over the 50 million to
not save it
say echo("Over limit")

i've tried all kinds of things and really stuck..

the code for my counter is


function updateTotalCost () {
var intTotal = 0
var currentCost = ""
var playerlist = ""
var playertext = ""
var playervalue = ""
for(var i=1; i<=11; i++) {

playerlist = eval("document.all.player" + i)

playertext = playerlist.options[playerlist.selectedIndex].text

playervalue = playerlist.options[playerlist.selectedIndex].value

if (playervalue != 0) {
intBeg = playertext.lastIndexOf (") ")
intEnd = playertext.lastIndexOf ("m")
intTotal += (10 * playertext.substring(intBeg+1, intEnd))
}
}
if (intTotal <= 500) {document.all.total.innerHTML = "<font color=\"yellow\"><b>" + (intTotal / 10) + "</b></font>";
document.all.overbudget.width = 0
document.all.overbudget.height = 0
}
else{
document.all.total.innerHTML = "<font color=\"red\"><b>" + (intTotal / 10) + "</b></font>";
document.all.overbudget.width = 92
document.all.overbudget.height = 17
}
}
// -->
</SCRIPT>
<FONT face=schoolboy size=5><SPAN class=bodycopy>Team Details
<P></FONT></SPAN><FONT face="MS Sans Serial"
size=4><SPAN class=bodycopy>Your Budget is €50m!
<P>Current Total = €<SPAN id=total


Any ideas??? this code is in my addauser page and then i want to check it in my savedata page??

help????

:confused:
 
Back
Top