I have a while loop that gathers information from my DB. I then echo that out like this...
$num = 1;
$i=0;
$drop = 'yes';
echo '<form id="drop_form" method="post" action="here.php">';
while( $row = mysql_fetch_assoc($query)) {
$player[] = $row['player'];
echo '<tr class="rows"><td>'; echo'<input type="hidden"
name="yeah" value="'.$num.'"/>
<input name="submit" type="submit" value="submit"/>';
echo $player[$i].'</td></tr>';
$num++;
$i++;
}
echo '</table>';
echo '</form>';
when I post my $num variable it always show up as the last possible number. So if there are 7 rows in that query then the number will be 7. I want to be able to click on the submit button and get the hidden value in the submit form.
Player
mike hidden number = 1
chris hidden number = 2
jim hidden number = 3
dan hidden number = 4
mysql_*functions will be deprecated in PHP 5.5. It is not recommended for writing new code as it will be removed in the future. Instead, either the MySQLi or PDO and be a better PHP Developer.yeah, with different values. When you post the form, the earlier ones will be over-written by later ones, so the only one actually submitted is the last one.{and}don't match up.name="yeah[]". That will post all the values as an array ($_POST['yeah']will be an array).