php help :)

Soldato
Joined
6 Apr 2008
Posts
3,352
Location
Reading
Hi again guys Im in a bit of a pickle.

I have this code here.

Code:
$nrows = mysqli_num_rows($result);

for ($i=1; $i <= $nrows; $i++)
{
	$row = mysqli_fetch_assoc($result);
	
	
    
	foreach ($labels as $field => $label)
	{
		
   		if ($field == 'Barcode' or $field == 'Make' or $field == 'Model' or $field == 'SerialNo')
		{
   			echo "<td>", $row[$field], "</td>";	
   		}
	} 
	
	echo "<form action = 'Results_item.php' method= 'POST'>";
	echo "<Input type = 'hidden' name = 'Barcode' value = '$row[Barcode]'>";
	echo "<td colspan = '1' style = 'text-align: right'>
    	  <Input type = 'submit' value = 'View Item'>";
	
	echo "<tr><td colspan = '10'><hr /></td></tr>";
}
echo "</table>\n";

now that outputs this.

Picture1-4.png


lovley

Obviously the buttons don't pass the correct value to the next php file as they take what ever the last value of the barcode was from the last item hence all buttons lead to the same bit of information.

how can I get them sending the correct bit of information for each item?

Thanks in advance :)

Edd
 
Back
Top Bottom