PHP beginner | 
                 | 
                
				
				Hallo, 
 
Ik probeer een eigen fotoalbumsysteem te maken, en ik heb de input-velden in een while-lus gedaan. Kan dit wel en/of is er een andere handige oplossing op 30 foto's in 1 keer te uploaden naar een database.  
Zie hier mn script: 
    
    
        
            
                <?php
include("connect.php");
?>
<html>
<head>
<title>TreinFoto-Online</title>
</head>
<body>
<b>Fotoalbum toevoegen.</b>
<FORM METHOD=POST ACTION='' enctype='multipart/form-data'>
Voorbeeldfoto:<br>
<input type="file" name="vbfoto"/>
<br><br>
Beschrijving:<br>
<textarea name="besch_alb" cols="40" rows="8"></textarea>
<br>
<br>
<?php
//datum berekenen
$dag = date(d);
$maand = date(m);
$jaar = date(Y);
$datum = $dag-$maand-$jaar;
//foto's invoeren
$upload = 0;
while($upload++ <= 29)
{
	print("Foto $upload: <input type=\"file\" name=\"foto$upload\"/><br>Beschrijving Foto $upload: <textarea cols=\"20\" rows=\"4\"></textarea><br><br>");
	
}//einde while
//foto's uploaden
$foto = 0;
while($foto++ <= 29)
{
		$rFoto = "foto$foto,";
if(isset($_POST['toevoegen']))
{
	$_POST['vbfoto'] = $vbfoto;
	$_POST['besch_alb'] = $besch_alb;
	$sql = "INSERT INTO tfol_fotoalbum(vbfoto,beschrijving,datum,"'.$rFoto."') VALUES('".$vbfoto."','".$besch_alb."','".$datum."','".$rFoto."')";
	mysql_query($sql) or die(mysql_error());
	
}//einde if 'toevoegen'
}//einde while
?>
<br>
<br>
<input type="submit" name="toevoegen" value="Fotoalbum toevoegen"/>
</form>
</body>
</html>
             
            <?php   include("connect.php");   ?>   <html>   <head> <title>TreinFoto-Online</title> </head>   <body>   <b>Fotoalbum toevoegen.</b>   <FORM METHOD=POST ACTION='' enctype='multipart/form-data'> Voorbeeldfoto:<br> <input type="file" name="vbfoto"/> <br><br> Beschrijving:<br> <textarea name="besch_alb" cols="40" rows="8"></textarea> <br> <br> <?php //datum berekenen $datum = $dag-$maand-$jaar;   //foto's invoeren $upload = 0; while($upload++ <= 29) { 	print("Foto $upload: <input type=\"file\" name=\"foto$upload\"/><br>Beschrijving Foto $upload: <textarea cols=\"20\" rows=\"4\"></textarea><br><br>");   }//einde while   //foto's uploaden $foto = 0; while($foto++ <= 29) { 		$rFoto = "foto$foto,";   if(isset($_POST['toevoegen'])) { 	$_POST['vbfoto'] = $vbfoto; 	$_POST['besch_alb'] = $besch_alb; 	$sql = "INSERT INTO tfol_fotoalbum(vbfoto,beschrijving,datum,"'.$rFoto."') VALUES('".$vbfoto."','".$besch_alb."','".$datum."','".$rFoto."')"; 	mysql_query($sql) or die(mysql_error());   }//einde if 'toevoegen' }//einde while ?> <br> <br> <input type="submit" name="toevoegen" value="Fotoalbum toevoegen"/> </form>   </body>   </html> 
 
  
         
          
     
   
 
Grtn Robin				
				 |