Jump to content


Photo

Come on Guys, Please help me out here...


  • Please log in to reply
4 replies to this topic

#1 wmoussalli

wmoussalli
  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 08 May 2006 - 04:04 AM

Hello there, I have been playing around with php for a while now yet i always get stuck with one aspect of code.

example used is clan website where am looking to add players stats

What i am trying to do is add stats for players on same team, i know how to add the stats on individual basis (1 at time then click an another) but i want to display on same page


Imagining that GAMETAG KILLS DEATHS are all textbox's

(1st player) GAMETAG KILLS DEATHS
(2nd player) GAMETAG KILLS DEATHS
(3rd player) GAMETAG KILLS DEATHS
(4th player) GAMETAG KILLS DEATHS

SUBMIT

Does anyone have any ideas, help would b much appreciated...
Thanking you for your time

Wayne

Below is ruffly what am looking for...


while ($numberofplayers > '0')
{
echo"<tr>

<td height=\"26\"><input type=text name=\"gametag[$numberofplayers]\" size=30></td>
<td><input type=text name=\"kills[$numberofplayers\" size=5></td>
<td><input type=text name=\"deaths[$numberofplayers]\"size=5></td>

</tr>";
$players--;
}

#2 trq

trq
  • Staff Alumni
  • Advanced Member
  • 31,041 posts

Posted 08 May 2006 - 04:17 AM

Sorry... Im lost. Do you want to know how to add the results after the forms submission, or how to create the form using a loop? You need to be more specific with what exactly your trying to do.

#3 wmoussalli

wmoussalli
  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 08 May 2006 - 05:16 PM

sorry dude, yes i am trying to create a loop that will hope fully give the textbox gametag and others a different name everytime its created. Example gametag1, gametag2 etc depending on how many players there are. And then need a statment to store them in mysql in a loop...


please help guys...

#4 Michael4172

Michael4172
  • Members
  • PipPipPip
  • Advanced Member
  • 41 posts

Posted 08 May 2006 - 05:44 PM

You'd want something like:
i = 0;
if ($name == "Gametag"){
    $name1 = $name;
    $name_count++;

    while ($i <= $name_count){
 
         COMBINE $name1 with $name_count++

                                             }
                                          }

All you'd need to do is to add the two names together by whateve method you prefer when adding the name and the number. Thus Gametag would be Gametag1 and then next occurance is Gametag2 ect...

#5 wmoussalli

wmoussalli
  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 08 May 2006 - 06:28 PM

thanks for reply mate, am gonna have a blast think it sound like should do the trick... Will keep posted :-)
thanks again...

Wayne




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users