0

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
	}
?>

Edited by Ezzaral: Added code tags. Please use them to format any code that you post.

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by rajarajan07
0

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;?>;

Edited by rajarajan07: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.