Jump to content


  • Posts

  • Joined

  • Last visited


Profile Information

  • Gender
    Not Telling

smproph's Achievements


Member (2/5)



  1. Problem is that now I would have to hardcode the players name. I tried adding $name= $_POST['participant_name']; $pnames = array($name); But as you probably know it is only adding one player instead of however many the user selected and it adds the name as "Array"
  2. INSERT INTO participants (participant_name, team_no, sport) VALUES ('ply2','Team'),('ply1','Team'),('pl5','Team'),('jfsd','Team'),('da','Team','dodgeball') I can see the dodgeball is only being added to the last player. But I cannot figure out why. Does it have to do to with my implode function?
  3. How should it look? I'm relatively new to php. It works perfectly whenever I take the '$sport' out of values and sport out of INPUT. But when I add them in I get that error
  4. Why am I getting this error when there are 3 Fields with 3 values? Column count doesn't match value count at row 1 $sql5="INSERT INTO participants (participant_name, team_no, sport) VALUES ('".implode("','$_POST[team]'),('",$_POST['participant_name'])."','$_POST[team]','$sport')";
  5. Simon once again that worked perfect. Last question, is there a way to have a save option? So the user doesn't lose it.
  6. I've modified to this $array = $teamname; $k=1; $x=1; $line[$i] = '<td><input type=button class="team" onclick="win(this)" value="' . $array[($i-1)/2] . '">name="WIN0_'.($k).'"</td>'; $k++; and this $line[$i] .= '<td><input type=button class="team" onclick="win(this)" value="">name="WIN1_'.($y+1).'"</td>'; $y=$x; Problem is it starts to repeat itself into future rounds. First round works perfect, second
  7. Populates great other than name="WIN1_1" onclick="win(this)" is missing in the input tag. But I think i should be able to write something where it changes the "WIN1_1" to "WIN1_2" on the next one and so on
  8. Take your time, and thanks. I thought that code I wrote above would work, but for some reason it doesn't like me lol
  9. Exactly, It's just like the March Madness bracket if you have ever seen one of those. You have Quarterfinals, then Semi Finals then Finals
  10. I added it and wrote it like this $teams=$_POST['teams']; $schedule=$_POST['schedule']; $teamname = unserialize(urldecode($_POST["teamname"])); $games=$_POST['games']; $times=$_POST['times']; $numofteams=(count($teamname)/2); Simon yours works perfect other than the fact I am trying to implement it to those <tr><td> because it makes it where you can click on the winner and it automatically advances them to the next bracket. It connects to my javascript I wrote thats in my first post.
  11. I wrote this: $i=1; $j=1; $k=1; $run=1; $run2=0; while($run<=$numofteams) { $name="WIN0_'".$i."'"; echo'<tr> <td><input type=button class="team" name="'.$name.'" onclick="win(this)" value="'.$teamname[$run].'"></td> </tr>'; $run++; if($run==2) { $name2="WIN1_'".$j."'"; echo '<tr> <td></td> <td><input type=button class="team" name="'.$name2.'" onclick="win(this)" value=""></td> </tr>'; if($run2==2) { $name3="WIN'".$k."'_1"; echo '<tr> <td></td> <td><input type=button class="team" name="'.$name3.'" onclick="win(this)" value=""></td> </tr>'; $run2=0; $k++; } $run=0; $run2++; $j++; } $i++; } It almost gets it but just repeats 10,000 times and only fills in team 1 and team 2
  12. Well right now, since I have only entered 4 teams in, it has Team 1 Team 2 Team 3 Team 4 as my array Array ( [0] => team1 [1] => team2 [2] => team3 [3] => team4 ) Not sure if I understood what you meant when you said I have it where you type in the teams in order by their seeds. So team1 is Seed #1, Team 2 is Seed #2 and so on... I am trying to get it to where it sees how many teams you put in, maybe with a count function on the array and then put them against each other, Seed 1 vs Seed 8. Does that make any sense?
  13. I have it to where it groups two parts of the Array randomly but I need to make it where it won't pair the same together, or if it has already been paired with a team then use another team. Each value of the array can only be used once. Here is my code shuffle($teamname); $loopCount = $games; for ($i = 0; $i < $loopCount; $i++) { $player1 = array_pop($teamname); $player2 = array_pop($teamname); if(is_null($player1)) { echo 'Not enough different teams to create '.$games.' games'; break; } // output to screen echo "Team: " . $player1 . " Vs Team: " . $player2 . "<br />"; } }
  14. Okay right now I have a form that pulls all the values I need and sends it to a separate page, except here is where I run into the problem. I logically have no idea who to write it. I have an array called $teamname that holds all the team names. What I need to do is make it dynamically create the table rows according to how many teams their are and then put the teams against each other like 1v8, 2v7. Here is my script that allows the bracket to work, I just need to convert it to dynamically work <script> function win(winner) { var team = winner.value; var levels = winner.name.substring(3).split("_"); var curlevel = parseInt(levels[0]); var curgame = parseInt(levels[1]); var nextlevel = curlevel + 1; var nextgame = Math.floor( (curgame+1) / 2 ); var winnerButton = winner.form.elements["WIN"+nextlevel+"_"+nextgame]; if ( winnerButton == null ) return; ++nextlevel; nextgame = Math.floor( (nextgame+1) / 2 ); var nextButton = winner.form.elements["WIN"+nextlevel+"_"+nextgame]; var forward = ( nextButton != null && nextButton.value == winnerButton.value ); winnerButton.value = team; if ( forward ) winnerButton.click( ); } </script> <?php $schedule=$_POST['schedule']; if($schedule=="season") { $teams=$_POST['teams']; $schedule=$_POST['schedule']; $teamname = unserialize(urldecode($_POST["teamname"])); $games=$_POST['games']; $times=$_POST['times']; } if($schedule=="playoffs") { $teams=$_POST['teams']; $schedule=$_POST['schedule']; $teamname = unserialize(urldecode($_POST["teamname"])); $games=$_POST['games']; $times=$_POST['times']; $result = count($teamname); ?> <form> <table border=0 cellpadding=3> <tr> <td><input type=button class="team" name="WIN0_1" onclick="win(this)" value="Amherst"></td> </tr> <tr> <td></td> <td><input type=button class="team" name="WIN1_1" onclick="win(this)" value=""></td> </tr> <tr> <td><input type=button class="team" name="WIN0_2" onclick="win(this)" value="Bowling Green"></td> </tr> <tr> <td> </td> <td> </td> <td><input type=button class="team" name="WIN2_1" onclick="win(this)" value=""></td> </tr> <tr> <td><input type=button class="team" name="WIN0_3" onclick="win(this)" value="Connecticut"></td> </tr> <tr> <td></td> <td><input type=button class="team" name="WIN1_2" onclick="win(this)" value=""></td> </tr> <tr> <td><input type=button class="team" name="WIN0_4" onclick="win(this)" value="Duke"></td> </tr> <tr> <td> </td> <td> </td> <td> </td> <td><input type=button class="team" name="WIN3_1" onclick="win(this)" value=""></td> </tr> <tr> <td><input type=button class="team" name="WIN0_5" onclick="win(this)" value="Elmira"></td> </tr> <tr> <td></td> <td><input type=button class="team" name="WIN1_3" onclick="win(this)" value=""></td> </tr> <tr> <td><input type=button class="team" name="WIN0_6" onclick="win(this)" value="Florida"></td> </tr> <tr> <td> </td> <td> </td> <td><input type=button class="team" name="WIN2_2" onclick="win(this)" value=""></td> </tr> <tr> <td><input type=button class="team" name="WIN0_7" onclick="win(this)" value="Georgetown"></td> </tr> <tr> <td></td> <td><input type=button class="team" name="WIN1_4" onclick="win(this)" value=""></td> </tr> <tr> <td><input type=button class="team" name="WIN0_8" onclick="win(this)" value="Hawaii"></td> </tr> </table> </form> <? } ?>
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.