# Hello!

Hi!

Well, I need help with my website. I created a program that counts the
number of players you have and the total cost to buy those players.
The number of players you bought should be added to the total. The
problem is, the number of players you bought won't add to the total
number of players. So, you buy it and the number is still equaled to
zero.

------------------------------------------------------------------------
Code:
------------------------------------------------------------------------

Sub Hire_Soldiers
Num = txtNumPeople.value
If Not IsNumeric(Num) Then
msgbox "You must enter a number in the box"
Else
If Num = 0 Then
msgbox "You must enter a number larger than zero"
Else
If Num > 112 Then
msgbox "You may only purchase 112 soldiers at a time."
Else
If 7146750 < Num*10000 Then
msgbox "You do not have enough money to hire that many! Please
enter a smaller number."
Else
msg = "Do you wish to spend \$ " & FormatNumber(Num*10000,0)
msg = msg & " to hire " & FormatNumber(Num,0) & " new soldier"
If Num > 1 Then msg = msg & "s"
msg = msg & "?"
If msgbox(msg,vbYesNo,"Hire New Soldiers") = vbYes Then
document.url = "buy_people.asp?txtNum=" & Num &
"&CameFrom=market"End If
End if
End If
End If
End If

End Sub
 Marketplace

You have 28 soldiers available. A platoon
requires 28
men. New recruits cost \$10,000 each.

To hire
new soldiers click
Recruit Soldiers

------------------------------------------------------------------------

Yes, the first part is scripted as visual basic. The problem seems to
be with the line : document.url = "buy_people.asp?txtNum=" & Num &
"&CameFrom=market"
Doesn't seem to go. Does any know how to by pass this and make it
added to the total number bought?

## Comments

• Use this line of code instead of document.url
<%
Response.Redirect("buy_people.asp?txtNum=" & Num & "CameFrom=market")
%>

..:: Zantos ::..

Sign In or Register to comment.

#### Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!