Re: Getting checkboxes as array

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello jack,

Friday, June 10, 2005, 2:16:06 AM, you wrote:

jj> $query = "INSERT INTO media_art (media_art_id,art_id, media_id)
jj>             VALUES ('','" . $art_id . "','" . $media_types[2]. "')";

jj> repeat as many or few times as possible to account for the number of
jj> checked boxes, such as

One way:

for ($i = 0; $i < count($media_types); $++)
{
    $query = "INSERT INTO media_art (media_art_id,art_id, media_id)
    VALUES ('','$art_id','{$media_types[$i]}')";
    // perform query here
}

Another:

foreach ($media_types as $type)
{
    $query = "INSERT INTO media_art (media_art_id,art_id, media_id)
    VALUES ('','$art_id','$type')";
    // perform query here
}

Best regards,

Richard Davey
-- 
 http://www.launchcode.co.uk - PHP Development Services
 "I do not fear computers. I fear the lack of them." - Isaac Asimov

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux