I need help, im trying to submit a variable value via a hidden form object called p_id. But whenever I submit the form I always get just one value. "2" in this case.
The idea is I have created a table, each row on the table is unique, and when I click a button on the row, it will take the p_id value attached to the row and pass it to the next page. But its not taking the p_id value I want
$query="SELECT tournament_start_date, signups_close_date, points_award, pug_id FROM pug_table ORDER by tournament_start_date ASC";
$result=mysql_query($query);
$num=mysql_numrows($result);
$i=0;
while ($i < $num) {
//assign values to variables
$startdate=mysql_result($result,$i,"tournament_start_date");
$signupdate=mysql_result($result,$i,"signups_close_date");
$pointsaward=mysql_result($result,$i,"points_award");
$pug_id=mysql_result($result,$i,"pug_id");
?>
Headings of my table
<form name="pugform" method="post" action="join_tournamentck.php">
<table width="80%" >
<tr>
<td><b>Tournament Start Date</b></td>
<td><b>Sign-ups Close Date</b></td>
<td><b>Tokens Awarded</b></td>
<td><b>Join/Un-join</b></td>
<td><b>Pug ID</b></td>
</tr>
creating individual rows in the table
<?
echo "<tr><td>$startdate</td><td>$signupdate</td><td>$pointsaward</td><td><input type=\"hidden\" name=\"p_id\" value=\"$pug_id\"><input type=\"submit\" value=\"Join/Un-join\"></td><td>$pug_id</td></tr>";
$i++;
}
?>
now that I have my php/html table output, I want to click the submit button on the relevant row and pass the p_id value for that row only. But it seems to pass the last p_id value generated through the SQL statement and not the p_id value for the row that I clicked the submit button on.
I hope this makes sense, how can I do this?