If I print them, there's nothing. all three

Here is the same file, in test mode... 

include "db.inc.back.php";

foreach ($_FILES["pictures"]["error"] as $key => $error) {
   if ($error == UPLOAD_ERR_OK) {
       echo "$error_codes[$error]";
         "bikeimages/" .$_FILES["pictures"]["name"][$key]
       ) or die("Problems with upload");
       ${"image".$key} = $_FILES['pictures']['name'];

$make = $_POST['make'];
$model = $_POST['model'];
$year = $_POST['year'];
$color = $_POST['color'];
$description = $_POST['description'];
//$image1 = $_POST['image1'];
//$image2 = $_POST['image2'];
//$image3 = $_POST['image3'];
$status = $_POST['status'];

echo "$image1 -- $image2 -- $image3";
$query = "INSERT INTO `inventory` (`make`, `model`, `year`, `color`,
`description`, `image1`, `image2`, `image3`, `status`)
            VALUES ('$make', '$model', '$year', '$color', '$description',
'$image1', '$image2', '$image3', '$status');";

$result = mysql_db_query("$db", $query) or displayErrorQuery ($query);

echo "<meta http-equiv='refresh' content='0;URL=inventorylist.php'>";

 I get " -- -- " outputted.

-----Original Message-----
From: Chris [mailto:[EMAIL PROTECTED] 
Sent: Thursday, November 30, 2006 10:39 PM
To: Gary E. Terry
Cc: php-db@lists.php.net
Subject: Re: [PHP-DB] Arrays from forms....

Gary E. Terry wrote:
> Sorry about that, not CC'ing the list...
> the values are not always empty, they should always have something in
> them...  
> There should be 3 images uploading. But, I am sure just to make life
> interesting,
> there will be times when there could be as little as one uploaded.

If you print them out what's in them?

echo $image1;
echo $image2;

I just realized that the $key probably starts at 0 instead of 1, so you 
might need to check that and then possibly:

${"image".($key+1)} = $_FILES['pictures']['name'];

Postgresql & php tutorials

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

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to