On 28 May 2004 04:47, Albert Padley wrote:
> I feel I'm so close.
>
> I have a form with multiple database records with a checkbox to
> indicate which records to update set up like so:
>
> $name = "ed[" . $row['id'] . "]";
>
>
>
> Each text input is set up like so:
>
>
>
> On the processing page I am doing this:
>
> foreach($ed as $id=>$val){
> $query = "UPDATE ref_events_reg
>SETfname = '$fname'
> WHERE id = '{$id}'";
>
> I am looping through the correct records, but every field is being
> updated to "Array".
>
> What tweak do I need to make?
I'd make two tweaks, actually. First and most obviously, you're not selecting *which*
fname field to pass to your update query, so this needs to be:
$query = "UPDATE ref_events_reg
SET fname = '{$fname[$id]}'
WHERE id = '{$id}'";
(By putting just $fname there, you are telling PHP to insert the string representation
of the whole array -- and the string representation of any array is, er, exactly
"Array"! ;)
This change may give you a clue to my other tweak -- I'd explicitly set the indexes of
all the fname[] fields to be sure they sync correctly to the related check box, thus:
Cheers!
Mike
-
Mike Ford, Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS, LS6 3QS, United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php