print "<form ...>"; print"<INPUT TYPE='submit' value='View details' Name='Details'>"; print"<input type='hidden' name='SelectedItemNumber' value='{$row[Id]}'"; print "</form>";
you'll then have as many forms as you have rows and which one is submitted will depend on which button is pressed. Tim Ward http://www.chessish.com mailto:[EMAIL PROTECTED] ----- Original Message ----- From: Denis L. Menezes <[EMAIL PROTECTED]> To: Tim Ward <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Tuesday, January 14, 2003 11:50 AM Subject: Re: [PHP] Error in variable when looping > Hello Tim. > > Could you help me a little further and tell me exactly where to put this? > > Thanks > Denis > ----- Original Message ----- > From: "Tim Ward" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > Sent: Tuesday, January 14, 2003 5:16 PM > Subject: Re: [PHP] Error in variable when looping > > > > you're not differentiating between form elements on different rows. > > all the hidden elements have the same name and are in the same > > form so only the last one will be available as all the submit buttons > > are in the same form. > > > > you need to put <form ...>...</form> tags around each submit/hidden > > pair. > > > > Tim Ward > > http://www.chessish.com > > mailto:[EMAIL PROTECTED] > > ----- Original Message ----- > > From: menezesd <[EMAIL PROTECTED]> > > To: <[EMAIL PROTECTED]> > > Sent: Tuesday, January 14, 2003 12:21 AM > > Subject: [PHP] Error in variable when looping > > > > > > > Hello friends, > > > > > > I have made the following table of data and a button on every row to > view > > the details. The code is working fine and the table is displayed with the > > buttons. > > > > > > The problem I have is that the $SelectedItemNumber posted to the next > page > > remains the same number no matter which row button I click. I have my > > relevant code below. Please help me. I know I am making a mistake > somewhere > > but I cannot figure out where. > > > > > > Quote : > > > > > > > > > > > le($row=mysql_fetch_array($result)){ > > > > > > Print " <tr> "; > > > Print "<td width=\"12%\" align=\"center\" height=\"6\" > bgcolor=\"#FFFFbf\"><font face=\"Tahoma\" color=\"#000000\">" ; > > > Print "<b> <font size=\"2\" color=\"ff0000\"> $row[OrgName] > </b></font>"; > > > print "</font> </td>"; > > > Print "<td width=\"12%\" align=\"center\" height=\"6\" > bgcolor=\"#FFFFbf\"><font size=\"2\" face=\"Tahoma\" color=\"#000000\">" ; > > > Print $row[OrgCountry]; > > > print "</font> </td>"; > > > Print "<td width=\"12%\" align=\"center\" height=\"6\" > bgcolor=\"#FFFFbf\"><font size=\"2\" face=\"Tahoma\" color=\"#000000\">" ; > > > Print $row[OrgNumber]; > > > print "</font> </td>"; > > > Print "<td width=\"12%\" align=\"center\" height=\"6\" > bgcolor=\"#FFFFbf\"><font size=\"2\" face=\"Tahoma\" color=\"#000000\">" ; > > > Print $row[Orgaddress]; > > > print "</font> </td>"; > > > Print "<td width=\"12%\" align=\"center\" height=\"6\" > bgcolor=\"#FFFFbf\"><font size=\"2\" face=\"Tahoma\" color=\"#0000 > > 00\">" ; > > > Print $row[OrgChief]; > > > print "</font> </td>"; > > > Print "<td width=\"12%\" align=\"center\" height=\"6\" > > bgcolor=\"#b7b700\"><font size=\"2\" face=\"Tahoma\" color=\"#000000\">" ; > > > Print"<INPUT TYPE=\"submit\" value=\"View details\" Name=\"Details\">"; > > > print "</td>"; > > > Print"<input type=\"hidden\" name=\"SelectedItemNumber\" value= > $row[Id]"; > > > Print "</tr>";} > > > } > > > ?> > > > > > > > > > > > > Unquote > > > > > > Thanks > > > Denis > > > > > > -- > > > PHP General Mailing List (http://www.php.net/) > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php