Salve.. Su svariati siti ho visto vari moduli già impostati con invio di allegato..
Avendo lavorato parecchio su un modulo.. quindi su un codice che già avevo.. non capendo molto di php.. non riesco ad inserire uno di quei codici per allegare un file..
Vi faccio vedere la pagina del modulo..
http://www.casebioedilizia.it/terreno.php
il codice in php è questo..
Codice PHP:
<?php
                              
if(isset($_POST['submit']))
{
    
if(!isset(
$_POST["nome"]) || $_POST["nome"] == '')
{
$err true;
echo 
"<div style=\"color:#404040;margin:0;font-size:10px;font-family: tahoma;padding:5px;font-weight:bold;\">NOME MANCANTE
</div>"
;
}
if(!isset(
$_POST["cognome"]) || $_POST["cognome"] == '')
{
$err true;
echo 
"<div style=\"color:#404040;margin:0;font-size:10px;font-family: tahoma;padding:5px;font-weight:bold;\">COGNOME MANCANTE
</div>"
;
}
if(!isset(
$_POST["localita"]) || $_POST["localita"] == '')
{
$err true;
echo 
"<div style=\"color:#404040;margin:0;font-size:10px;font-family: tahoma;padding:5px;font-weight:bold;\">LOCALITA MANCANTE
</div>"
;   
}
if(!isset(
$_POST["cap"]) || $_POST["cap"] == '')
{
$err true;
echo 
"<div style=\"color:#404040;margin:0;font-size:10px;font-family: tahoma;padding:5px;font-weight:bold;\">CAP MANCANTE
</div>"
;   
}
if(!isset(
$_POST["tel"]) || $_POST["tel"] == '')
{
$err true;
echo 
"<div style=\"color:#404040;margin:0;font-size:10px;font-family: tahoma;padding:5px;font-weight:bold;\">RECAPITO TELEFONICO MANCANTE
</div>"
;
}
if(!isset(
$_POST["mail"]) || $_POST["mail"] == '')
{
$err true;
echo 
"<div style=\"color:#404040;margin:0;font-size:10px;font-family: tahoma;padding:5px;font-weight:bold;\">MAIL MANCANTE
</div>"
;
}


if(!isset(
$_POST["provincia"]) || $_POST["provincia"] == '')
{
$err true;
echo 
"<div style=\"color:#404040;margin:0;font-size:10px;font-family: tahoma;padding:5px;font-weight:bold;\">PROVINCIA MANCANTE
</div>"
;   
}
if(!isset(
$_POST["citta"]) || $_POST["citta"] == '')
{
$err true;
echo 
"<div style=\"color:#404040;margin:0;font-size:10px;font-family: tahoma;padding:5px;font-weight:bold;\">CITTA MANCANTE
</div>"
;   
}

if(!isset(
$_POST["m2"]) || $_POST["m2"] == '')
{
$err true;
echo 
"<div style=\"color:#404040;margin:0;font-size:10px;font-family: tahoma;padding:5px;font-weight:bold;\">SUPERFICIE IN MQ MANCANTE
</div>"
;   
}

if(!isset(
$_POST["cubatura"]) || $_POST["cubatura"] == '')
{
$err true;
echo 
"<div style=\"color:#404040;margin:0;font-size:10px;font-family: tahoma;padding:5px;font-weight:bold;\">CUBATURA EDIFICABILE MANCANTE
</div>"
;   
}

if(!isset(
$_POST["prezzo"]) || $_POST["prezzo"] == '')
{
$err true;
echo 
"<div style=\"color:#404040;margin:0;font-size:10px;font-family: tahoma;padding:5px;font-weight:bold;\">PREZZO MANCANTE
</div>"
;   
}
 



if(!isset(
$_POST["descrizione"]) || $_POST["descrizione"] == '')
{
$err true;
echo 
"<div style=\"color:#404040;margin:0;font-size:10px;font-family: tahoma;padding:5px;font-weight:bold;\">DESCRIZIONE MANDANTE
</div>"
;   
}


if(!isset(
$_POST["terreno"]) || $_POST["terreno"] == '')
{
$err true;
echo 
"<div style=\"color:#404040;margin:0;font-size:10px;font-family: tahoma;padding:5px;font-weight:bold;\">SELEZIONA IL TIPO DI TERRENO
</div>"
;   
}
if(!isset(
$_POST["privacy"]) || $_POST["privacy"] == '')
{
$err true;
echo 
"<div style=\"color:#404040;margin:0;font-size:10px;font-family: tahoma;padding:5px;font-weight:bold;\">ACCONSENTIRE LEGGE PRIVACY
</div>"
;   
}
if(isset(
$err))
   die(
"<div style=\"margin:0;padding: 20px\" align=\"center\"><a href=\"javascript:history.back()\" style=\"text-decoration:underline;font-weight:bold;font-size:10px;font-family: tahoma;\">« TORNA INDIETRO</a></div>");    

    
    
    
 
// L'INDIRIZZO DEL DESTINATARIO DELLA MAIL
 
$to "infotecnowood@gmail.com";
 
 
// IL SOGGETTO DELLA MAIL
 
$subject "PROPOSTA TERRENO - CASEBIOEDILIZIA.IT";
 
 
// COSTRUZIONE DEL CORPO DEL MESSAGGIO
 
$body "Contenuto del modulo:\n\n";
 
 
$body .= "Dati Utente:\nCognome: " trim(stripslashes($_POST["cognome"])) . "\n";
 
$body .= "Nome: " trim(stripslashes($_POST["nome"])) . "\n";
    
$body .= "Località: " trim(stripslashes($_POST["localita"])) . "\n";
   
$body .= "Cap: " trim(stripslashes($_POST["cap"])) . "\n";
 
$body .= "Recapito Telefonico: " trim(stripslashes($_POST["tel"])) . "\n";
  
$body .= "Email: " trim(stripslashes($_POST["mail"])) . "\n\n";
 
$body .= "Dati Terreno:\nProvincia: " trim(stripslashes($_POST["provincia"])) . "\n";
 
$body .= "Città: " trim(stripslashes($_POST["citta"])) . "\n";
  
$body .= "m2 globali: " trim(stripslashes($_POST["m2"])) . "\n";
     
$body .= "Cubatura edificabile: " trim(stripslashes($_POST["cubatura"])) . "\n"
  
$body .= "Prezzo: " trim(stripslashes($_POST["prezzo"])) . "\n";

  
$body .= "Descrizione: " trim(stripslashes($_POST["descrizione"])) . "\n\n";
     
$body .= "Caratteristiche:\nTerreno Urbanizzato? " trim(stripslashes($_POST["terreno"])) . "\n";
    
$body .= "Altri dettagli:\n" trim(stripslashes($_POST["terreno2"])) . "\n" trim(stripslashes($_POST["zona"])) . "\n" trim(stripslashes($_POST["zona2"])) . "\n\n";


 
$body .= "Ricevere Newsletter?: " trim(stripslashes($_POST["new"])) . "\n";

 
 
// INTESTAZIONI SUPPLEMENTARI
 
$headers "From: Modulo utenti <INDIRIZZO-COME-SOPRA>";
 
 
// INVIO DELLA MAIL
 
if(@mail($to$subject$body$headers)) { // SE L'INOLTRO E' ANDATO A BUON FINE...
 
  
die ("<div style=\"text-align:center;color:#404040;margin:0;font-family:tahoma;padding-top: 30px;font-size: 12px; line-height: 15px;\" align=\"center\">"."<span style=\"font-weight:bold\">LA TUA PROPOSTA SARA' ORA VERIFICATA.</span>


 Quando sarà approvata, ti verra inviata
 una
 mail per avvisarti dell'avvenuta pubblicazione."
."</div>".
 
"<div style=\"margin:0;padding: 20px\" align=\"center\"><a href=\"www.casebioedilizia.it\" style=\"text-decoration:underline;font-weight:bold;font-size:10px;font-family: tahoma;\">TORNA ALLA HOME</a></div>");
  
 
 } 
 
   else {
// ALTRIMENTI...
 
 
die("text-align:center;color:#404040;margin:0;font-family:tahoma;font-weight:bold;padding-top: 30px;font-size: 12px;\" align=\"center\">"."ERRORE MAIL."."</div>".
 
"<div style=\"margin:0;padding: 20px\" align=\"center\"><a href=\"javascript:history.back()\" style=\"text-decoration:underline;font-weight:bold;font-size:10px;font-family: tahoma;\">« TORNA INDIETRO</a></div>"
 
);

 
 }
 
  
 
 
 }

 
 
?>
l'input dell'allegato è..
<input type="file" name="attachment">

Mi chiedevo se qualcuno mi potesse dedicare 5minuti di tempo.. per completare il modulo.. ve ne sarei veramente grato.. grazie in anticipo..
Samuele D'Arenzo.
Codice PHP:
ty