You are here: Getting a (non-radio) button's index number from array « PHP Programming Language « IT news, forums, messages
Getting a (non-radio) button's index number from array

Posted by sgottenyc on 04/19/07 01:13

Hello,
If you could assist me with the following situation, I would be very
grateful.

I have a table of data retrieved from database displayed on screen.
To each row of data, I have added action buttons, such as "Edit",
"Add", and "Comment". Since I do not know how many rows of data will
be retrieved - and therefore how many buttons I need - I am using
button arrays for each button, like so:
echo "<input type=\"submit\" value=\"Comment\" name=\"Comment[]\" />";

In the php file that processes the input from this form, I have the
following code, which I was under the impression would give me the
index in the Comment array of the button that was fired.
if (isset($_POST['CommentMedicalHistory']))
{
$indexOfComment = each($_POST['CommentMedicalHistory']);
echo "index = {$indexOfComment['key']}";
}
Unfortunately, it is returning 0 as the index all the time, even when
I do not click on the Comment button in the first row.
Do you know by any chance how I could get the correct index of the
button that was pressed from the array?

Thank you, once again, for any assistance that you can provide,
Simon Gottesman

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация