rendered paste bodywhile ($inputIndex <= $imgIndex) { //Grab post image checkbox value. $selectImage = $_POST['select_image'.$inputIndex]; //If images was selected, grab all image post vars. if($selectImage == "yes") { $image_name = $_POST['image_name'.$inputIndex]; $artist = $_POST['artist'.$inputIndex]; $edition = $_POST['edition'.$inputIndex]; $base_medium = $_POST['base_medium'.$inputIndex]; $image_x= $_POST['image_x'.$inputIndex]; $image_y = $_POST['image_y'.$inputIndex]; $image_z = $_POST['image_z'.$inputIndex]; $paper_size = $_POST['paper_size'.$inputIndex]; $vendor_code = $_POST['vendor_code'.$inputIndex]; $style = $_POST['style'.$inputIndex]; $image_price = $_POST['image_price'.$inputIndex]; $framed_price = $_POST['framed_price'.$inputIndex]; $query = "INSERT INTO Art ('',image_name, artist,edition,base_medium,surface_medium, image_x,image_y,image_z,paper_size,vendor_code,style, image_price,framed_price) VALUES('','$image_name', '$artist', '$edition', '$base_medium', '$surface_medium', '$image_x','$image_y','$image_z','$paper_size','$vendor_code','$style', '$image_price,'$framed_price')"; echo $image_name; mysql_query($query) or die("query failed"); } $inputIndex++; }