On Mon, 2004-03-01 at 15:03, Chris W. Parker wrote:

> in that case i think php turns form elements with [] on the end of them
> into regular arrays. example:
> 
> <?php
>       $edit_rider_action = $_GET['edit_rider_action'];
> ?>
> 
> you then access it just like any other array:
> 
> <?php
>       foreach($edit_rider_action as $key => $value)
>       {
>               echo "$key, $value<br/>\n";
>       }
> 
>       $action_cnt = count($edit_rider_action);
> 
>       for($ictr = 0; $ictr < $action_cnt; $ictr++)
>       {
>               echo "$ictr, {$edit_rider_action[$ictr]}<br/>\n";
>       }
> ?>
> 
> does that help?


Sort of:

The count for edit_rider_action will always be 1 and it's key/value
needs to mate with one of the rest of the form rows.

For example

Name     Class   comments   Action
Rider 1  1       foo        edit() delete()
Rider 2  2       bar        edit() delete()
Rider 3  2       dolar      edit() delete()

Name, Class, and comments are all text fields that can be edited. Only
one of these at a time will be edited or deleted. I just need to
determine which row has "Action Selected" and then of course WHICH
action. I can get at the data but if you consider something like this:

while(list($k,$v) = each($rider_id)) {
    echo "$k => $v<br />\n";
    while(list($key, $value) = each($edit_rider_action )) {
        echo "$key => $value<br />\n";
    }
}

the edit_rider_action always has an array index of 0 and I'm not sure
how to associate it with a particular row. Perhaps I can not be cause it
has no unique value in each row. Maybe I need to set an index and
associate it that way as in:

$num_rows = mysql_num_rows($dbresult_riderlist);
$i = 0;

while ($result = mysql_fetch_array($dbresult_riderlist)) {
  Edit: <input type="radio" name="edit_rider_action[$i]" value="edit" />
  Delete: <input type="radio" name="edit_rider_action[$i]"
value="delete" />

$i++;
}

-- 
Brian V Bonini <[EMAIL PROTECTED]>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to