mysql - Pass a dynamic variable through URL php -
i'm not sure title, tried best. have table displayed information database using file
display.php
<?php mysql_connect("localhost", "root", "root") or die(mysql_error()); mysql_select_db("tournaments") or die(mysql_error()); $result = mysql_query("select * tournies") or die(mysql_error()); echo '<table id="bets" class="tablesorter" cellspacing="0" summary="datapass"> <thead> <tr> <th>tournament <br> name</th> <th>pot</th> <th>maximum <br> players</th> <th>minimum <br> players</th> <th>host</th> <th></th> <th></th> </tr> </thead> <tbody>'; while($row = mysql_fetch_array( $result )) { $i=0; if( $i % 2 == 0 ) { $class = ""; } else { $class = ""; } echo "<tr" . $class . "><td>"; echo $row['tour_name']; $tour_id = $row['tour_name']; echo "</td><td>"; echo $row['pot']," tokens"; echo "</td><td class=\"br\">"; echo $row['max_players']," players"; echo "</td><td class=\"br\">"; echo $row['min_players']," players"; echo "</td><td class=\"br\">"; echo $row['host']; echo "</td><td>"; echo "<input id=\"delete_button\" type=\"button\" value=\"delete row\" onclick=\"somedeleterowfunction(this)\">"; echo "</td><td>"; echo "<form action=\"join.php?name=$name\" method=\"post\" >"; echo "<input id=\"join_button\" type=\"submit\" value=\"join\">"; echo "</td></tr>"; } echo "</tbody></table>"; ?>
basically want user press button row of table , go new page called join.php. need persons username , name of tournament row clicked.
for example here's page:
when click join button @ end of row 1 should send them
'join.php?name=thierusernamehere&tourname=dfgdds'
any appreciated. thanks.
echo '<td><a href="join.php?name='.$row['name'].'&tourname='.$row['tour_name'].'">join</a></td>'
Comments
Post a Comment