When I call this this form in self submission the calue of the drink_id is always the last

id value of the table......
How to retrive the proper value as per id ???

<form name="drinks" method="post" action="<?php $_SERVER['SELF_PHP']?>">
<table width="100%" border="0" cellspacing="10" cellpadding="0">

<?php

$d_id=1;
$query01  = "SELECT * FROM pesos_drinks where d_id = $d_id";
$result01 = mysql_query($query01) or die("Query failed with error: ".mysql_error());

while($row01 = mysql_fetch_array($result01))
{
?>
	<tr>
				                <td align="left" valign="top" 

class="name"><?php echo $row01['drink_name'] ?></td>
                                <td align="left" valign="bottom" class="status"><img 

src="images/icon-status.gif" alt="" width="19" height="20" /><a href="#" 

class="set">(Set)</a></td>
								
                                <td align="right" valign="top"><input name="update1" 

type="text" class="update-field" value="<?php echo $row01['drink_name'] ?>"></td>
                                <td align="left" valign="top"><input type="submit" 

value="Update" style="background:url(images/bttn-update.jpg) top left no-repeat; padding:0 0 

0 5px; border:none; width:58px; height:21px; display:block; color:#fff; font-weight:bold; 

font-size:11px;" />

	<input type="hidden" name="drink_id" value="<?php echo $row01['id'] ?>">		

	<input type="hidden" name="posted1" value="TRUE">
		
		</td>
         </tr>
<?php
	}
?>
Member Avatar for rajarajan2017

Why dont you just call the file based on the click.
Write a javascript to validate which one is clicked and use the

window.locaiton="update.php?id=".<?php echo $id;?>;
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.