<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Problema form php]]></title><description><![CDATA[<p dir="auto">Salve a tutti!Vi chiedo cortesemente un grande favore,non essendo esperto di php.<br />
Devo creare un form mail che abbia i campi obbligatori e che permetta anche di allegare un file (qualsiasi).<br />
Il suo contenuto deve essere più o meno così :<br />
Nome*<br />
Cognome*<br />
Mail*<br />
Città<br />
Telefono*<br />
Codice fiscale*<br />
Partita Iva*<br />
Allega file*</p>
<p dir="auto">*= campi obbligatori</p>
<p dir="auto">Ho provato molti script, ma con molti script se inserisco l'allegato mi arrivano per email anche tutti i dati nome, cognome, mail, citta', mentre se non inserisco allegato l'email mi arriva vuota.<br />
Io voglio che anche non inserendo l'allegato l'email venga vista correttamente con tutti i suoi dati.<br />
E' possibile?</p>
<p dir="auto">Vi posto il codice php che ho utilizzato</p>
<pre><code>[FONT=Courier New][COLOR=#0000bb]&lt;?php [/COLOR][/FONT]
 
[FONT=Courier New][COLOR=#0000bb]$to[/COLOR][COLOR=#007700]= [/COLOR][COLOR=#dd0000]"mia email"[/COLOR][/FONT][FONT=Courier New][COLOR=#007700]; [/COLOR][/FONT]
[FONT=Courier New][COLOR=#0000bb]$nome[/COLOR][COLOR=#007700]=[/COLOR][COLOR=#0000bb]$_POST[/COLOR][COLOR=#007700][[/COLOR][COLOR=#dd0000]'nome'[/COLOR][/FONT][FONT=Courier New][COLOR=#007700]]; [/COLOR][/FONT]
[FONT=Courier New][COLOR=#0000bb]$cognome[/COLOR][COLOR=#007700]=[/COLOR][COLOR=#0000bb]$_POST[/COLOR][COLOR=#007700][[/COLOR][COLOR=#dd0000]'cognome'[/COLOR][/FONT][FONT=Courier New][COLOR=#007700]]; [/COLOR][/FONT]
[FONT=Courier New][COLOR=#0000bb]$oggetto[/COLOR][COLOR=#007700]=[/COLOR][COLOR=#0000bb]$_POST[/COLOR][COLOR=#007700][[/COLOR][COLOR=#dd0000]'oggetto'[/COLOR][/FONT][FONT=Courier New][COLOR=#007700]]; [/COLOR][/FONT]
[FONT=Courier New][COLOR=#0000bb]$mail[/COLOR][COLOR=#007700]=[/COLOR][COLOR=#0000bb]$_POST[/COLOR][COLOR=#007700][[/COLOR][COLOR=#dd0000]'mail'[/COLOR][/FONT][FONT=Courier New][COLOR=#007700]]; [/COLOR][/FONT]
[FONT=Courier New][COLOR=#0000bb]$citta[/COLOR][COLOR=#007700]=[/COLOR][COLOR=#0000bb]$_POST[/COLOR][COLOR=#007700][[/COLOR][COLOR=#dd0000]'citta'[/COLOR][/FONT][FONT=Courier New][COLOR=#007700]]; [/COLOR][/FONT]
[FONT=Courier New][COLOR=#0000bb]$telefono[/COLOR][COLOR=#007700]=[/COLOR][COLOR=#0000bb]$_POST[/COLOR][COLOR=#007700][[/COLOR][COLOR=#dd0000]'telefono'[/COLOR][/FONT][FONT=Courier New][COLOR=#007700]]; [/COLOR][/FONT]
[FONT=Courier New][COLOR=#0000bb]$codice_fiscale[/COLOR][COLOR=#007700]=[/COLOR][COLOR=#0000bb]$_POST[/COLOR][COLOR=#007700][[/COLOR][COLOR=#dd0000]'codice_fiscale'[/COLOR][/FONT][FONT=Courier New][COLOR=#007700]]; [/COLOR][/FONT]
[FONT=Courier New][COLOR=#0000bb]$p_iva[/COLOR][COLOR=#007700]=[/COLOR][COLOR=#0000bb]$_POST[/COLOR][COLOR=#007700][[/COLOR][COLOR=#dd0000]'p_iva'[/COLOR][/FONT][FONT=Courier New][COLOR=#007700]]; [/COLOR][/FONT]
 
[FONT=Courier New][COLOR=#0000bb]$messaggio[/COLOR][COLOR=#007700]=[/COLOR][/FONT][FONT=Courier New][COLOR=#dd0000]' [/COLOR][/FONT]
 
[FONT=Courier New][COLOR=#dd0000]Nome : [/COLOR][/FONT]
[FONT=Courier New][COLOR=#dd0000]'[/COLOR][COLOR=#007700].[/COLOR][COLOR=#0000bb]$nome[/COLOR][COLOR=#007700].[/COLOR][/FONT][FONT=Courier New][COLOR=#dd0000]' [/COLOR][/FONT]
 
[FONT=Courier New][COLOR=#dd0000]Cognome : [/COLOR][/FONT]
[FONT=Courier New][COLOR=#dd0000]'[/COLOR][COLOR=#007700].[/COLOR][COLOR=#0000bb]$cognome[/COLOR][COLOR=#007700].[/COLOR][/FONT][FONT=Courier New][COLOR=#dd0000]' [/COLOR][/FONT]
 
[FONT=Courier New][COLOR=#dd0000]Oggetto : [/COLOR][/FONT]
[FONT=Courier New][COLOR=#dd0000]'[/COLOR][COLOR=#007700].[/COLOR][COLOR=#0000bb]$oggetto[/COLOR][COLOR=#007700].[/COLOR][/FONT][FONT=Courier New][COLOR=#dd0000]' [/COLOR][/FONT]
 
[FONT=Courier New][COLOR=#dd0000]Mail : [/COLOR][/FONT]
[FONT=Courier New][COLOR=#dd0000]'[/COLOR][COLOR=#007700].[/COLOR][COLOR=#0000bb]$mail[/COLOR][COLOR=#007700].[/COLOR][/FONT][FONT=Courier New][COLOR=#dd0000]' [/COLOR][/FONT]
 
[FONT=Courier New][COLOR=#dd0000]Città : [/COLOR][/FONT]
[FONT=Courier New][COLOR=#dd0000]'[/COLOR][COLOR=#007700].[/COLOR][COLOR=#0000bb]$citta[/COLOR][COLOR=#007700].[/COLOR][/FONT][FONT=Courier New][COLOR=#dd0000]' [/COLOR][/FONT]
 
[FONT=Courier New][COLOR=#dd0000]Telefono : [/COLOR][/FONT]
[FONT=Courier New][COLOR=#dd0000]'[/COLOR][COLOR=#007700].[/COLOR][COLOR=#0000bb]$telefono[/COLOR][COLOR=#007700].[/COLOR][/FONT][FONT=Courier New][COLOR=#dd0000]' [/COLOR][/FONT]
 
[FONT=Courier New][COLOR=#dd0000]Codice Fiscale : [/COLOR][/FONT]
[FONT=Courier New][COLOR=#dd0000]'[/COLOR][COLOR=#007700].[/COLOR][COLOR=#0000bb]$codice_fiscale[/COLOR][COLOR=#007700].[/COLOR][/FONT][FONT=Courier New][COLOR=#dd0000]' [/COLOR][/FONT]
 
[FONT=Courier New][COLOR=#dd0000]p_iva : [/COLOR][/FONT]
[FONT=Courier New][COLOR=#dd0000]'[/COLOR][COLOR=#007700].[/COLOR][COLOR=#0000bb]$p_iva[/COLOR][COLOR=#007700].[/COLOR][/FONT][FONT=Courier New][COLOR=#dd0000]' [/COLOR][/FONT]
 
[FONT=Courier New][COLOR=#dd0000]'[/COLOR][/FONT][FONT=Courier New][COLOR=#007700]; [/COLOR][/FONT]
 
[FONT=Courier New][COLOR=#0000bb]$allegato [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000bb]$_FILES[/COLOR][COLOR=#007700][[/COLOR][COLOR=#dd0000]'allegato'[/COLOR][COLOR=#007700]][[/COLOR][COLOR=#dd0000]'tmp_name'[/COLOR][/FONT][FONT=Courier New][COLOR=#007700]]; [/COLOR][/FONT]
[FONT=Courier New][COLOR=#0000bb]$allegato_type [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000bb]$_FILES[/COLOR][COLOR=#007700][[/COLOR][COLOR=#dd0000]'allegato'[/COLOR][COLOR=#007700]][[/COLOR][COLOR=#dd0000]'type'[/COLOR][/FONT][FONT=Courier New][COLOR=#007700]]; [/COLOR][/FONT]
[FONT=Courier New][COLOR=#0000bb]$allegato_name [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000bb]$_FILES[/COLOR][COLOR=#007700][[/COLOR][COLOR=#dd0000]'allegato'[/COLOR][COLOR=#007700]][[/COLOR][COLOR=#dd0000]'name'[/COLOR][/FONT][FONT=Courier New][COLOR=#007700]]; [/COLOR][/FONT]
 
[FONT=Courier New][COLOR=#0000bb]$headers [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#dd0000]"From: " [/COLOR][COLOR=#007700]. [/COLOR][COLOR=#0000bb]$mail[/COLOR][/FONT][FONT=Courier New][COLOR=#007700]; [/COLOR][/FONT]
[FONT=Courier New][COLOR=#0000bb]$msg [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#dd0000]""[/COLOR][/FONT][FONT=Courier New][COLOR=#007700]; [/COLOR][/FONT]
 
[FONT=Courier New][COLOR=#007700]if ([/COLOR][COLOR=#0000bb]is_uploaded_file[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000bb]$allegato[/COLOR][/FONT][FONT=Courier New][COLOR=#007700])) [/COLOR][/FONT]
[FONT=Courier New][COLOR=#007700]{ [/COLOR][/FONT]
[FONT=Courier New][COLOR=#0000bb]$file [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000bb]fopen[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000bb]$allegato[/COLOR][COLOR=#007700],[/COLOR][COLOR=#dd0000]'rb'[/COLOR][/FONT][FONT=Courier New][COLOR=#007700]); [/COLOR][/FONT]
[FONT=Courier New][COLOR=#0000bb]$data [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000bb]fread[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000bb]$file[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000bb]filesize[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000bb]$allegato[/COLOR][/FONT][FONT=Courier New][COLOR=#007700])); [/COLOR][/FONT]
[FONT=Courier New][COLOR=#0000bb]fclose[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000bb]$file[/COLOR][/FONT][FONT=Courier New][COLOR=#007700]); [/COLOR][/FONT]
[FONT=Courier New][COLOR=#0000bb]$data [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000bb]chunk_split[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000bb]base64_encode[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000bb]$data[/COLOR][/FONT][FONT=Courier New][COLOR=#007700])); [/COLOR][/FONT]
[FONT=Courier New][COLOR=#0000bb]$semi_rand [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000bb]md5[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000bb]time[/COLOR][/FONT][FONT=Courier New][COLOR=#007700]()); [/COLOR][/FONT]
[FONT=Courier New][COLOR=#0000bb]$mime_boundary [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#dd0000]"==Multipart_Boundary_x{$semi_rand}x"[/COLOR][/FONT][FONT=Courier New][COLOR=#007700]; [/COLOR][/FONT]
 
[FONT=Courier New][COLOR=#0000bb]$headers [/COLOR][COLOR=#007700].= [/COLOR][COLOR=#dd0000]"\nMIME-Version: 1.0\n"[/COLOR][/FONT][FONT=Courier New][COLOR=#007700]; [/COLOR][/FONT]
[FONT=Courier New][COLOR=#0000bb]$headers [/COLOR][COLOR=#007700].= [/COLOR][COLOR=#dd0000]"Content-Type: multipart/mixed;\n"[/COLOR][/FONT][FONT=Courier New][COLOR=#007700]; [/COLOR][/FONT]
[FONT=Courier New][COLOR=#0000bb]$headers [/COLOR][COLOR=#007700].= [/COLOR][COLOR=#dd0000]" boundary=\"{$mime_boundary}\""[/COLOR][/FONT][FONT=Courier New][COLOR=#007700]; [/COLOR][/FONT]
[FONT=Courier New][COLOR=#0000bb]$msg [/COLOR][COLOR=#007700].= [/COLOR][COLOR=#dd0000]"This is a multi-part message in MIME format.\n\n"[/COLOR][/FONT][FONT=Courier New][COLOR=#007700]; [/COLOR][/FONT]
[FONT=Courier New][COLOR=#0000bb]$msg [/COLOR][COLOR=#007700].= [/COLOR][COLOR=#dd0000]"--{$mime_boundary}\n"[/COLOR][/FONT][FONT=Courier New][COLOR=#007700]; [/COLOR][/FONT]
 
 
[FONT=Courier New][COLOR=#0000bb]$msg [/COLOR][COLOR=#007700].= [/COLOR][COLOR=#dd0000]"Content-Type: text/plain; charset=\"iso-8859-1\"\n"[/COLOR][/FONT][FONT=Courier New][COLOR=#007700]; [/COLOR][/FONT]
[FONT=Courier New][COLOR=#0000bb]$msg [/COLOR][COLOR=#007700].= [/COLOR][COLOR=#dd0000]"Content-Transfer-Encoding: 7bit\n\n"[/COLOR][/FONT][FONT=Courier New][COLOR=#007700]; [/COLOR][/FONT]
[FONT=Courier New][COLOR=#0000bb]$msg [/COLOR][COLOR=#007700].= [/COLOR][COLOR=#0000bb]$messaggio [/COLOR][COLOR=#007700]. [/COLOR][COLOR=#dd0000]"\n\n"[/COLOR][/FONT][FONT=Courier New][COLOR=#007700]; [/COLOR][/FONT]
[FONT=Courier New][COLOR=#0000bb]$msg [/COLOR][COLOR=#007700].= [/COLOR][COLOR=#dd0000]"--{$mime_boundary}\n"[/COLOR][/FONT][FONT=Courier New][COLOR=#007700]; [/COLOR][/FONT]
 
[FONT=Courier New][COLOR=#0000bb]$msg [/COLOR][COLOR=#007700].= [/COLOR][COLOR=#dd0000]"Content-Disposition: attachment;\n"[/COLOR][/FONT][FONT=Courier New][COLOR=#007700]; [/COLOR][/FONT]
[FONT=Courier New][COLOR=#0000bb]$msg [/COLOR][COLOR=#007700].= [/COLOR][COLOR=#dd0000]" filename=\"{$allegato_name}\"\n"[/COLOR][/FONT][FONT=Courier New][COLOR=#007700]; [/COLOR][/FONT]
[FONT=Courier New][COLOR=#0000bb]$msg [/COLOR][COLOR=#007700].= [/COLOR][COLOR=#dd0000]"Content-Transfer-Encoding: base64\n\n"[/COLOR][/FONT][FONT=Courier New][COLOR=#007700]; [/COLOR][/FONT]
[FONT=Courier New][COLOR=#0000bb]$msg [/COLOR][COLOR=#007700].= [/COLOR][COLOR=#0000bb]$data [/COLOR][COLOR=#007700]. [/COLOR][COLOR=#dd0000]"\n\n"[/COLOR][/FONT][FONT=Courier New][COLOR=#007700]; [/COLOR][/FONT]
 
[FONT=Courier New][COLOR=#0000bb]$msg [/COLOR][COLOR=#007700].= [/COLOR][COLOR=#dd0000]"--{$mime_boundary}--\n"[/COLOR][/FONT][FONT=Courier New][COLOR=#007700]; [/COLOR][/FONT]
[FONT=Courier New][COLOR=#007700]} [/COLOR][/FONT]
[FONT=Courier New][COLOR=#007700]else [/COLOR][/FONT]
[FONT=Courier New][COLOR=#007700]{ [/COLOR][/FONT]
[FONT=Courier New][COLOR=#007700]echo [/COLOR][COLOR=#dd0000]"&lt;p&gt;Errore!&lt;/p&gt;"[/COLOR][/FONT][FONT=Courier New][COLOR=#007700]; [/COLOR][/FONT]
[FONT=Courier New][COLOR=#007700]} [/COLOR][/FONT]
 
 
[FONT=Courier New][COLOR=#007700]if ([/COLOR][COLOR=#0000bb]mail[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000bb]$to[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000bb]$oggetto[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000bb]$msg[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000bb]$headers[/COLOR][/FONT][FONT=Courier New][COLOR=#007700])) [/COLOR][/FONT]
[FONT=Courier New][COLOR=#007700]{ [/COLOR][/FONT]
[FONT=Courier New][COLOR=#007700]echo [/COLOR][COLOR=#dd0000]"&lt;p&gt;Mail inviata con successo!&lt;/p&gt;"[/COLOR][/FONT][FONT=Courier New][COLOR=#007700]; [/COLOR][/FONT]
[FONT=Courier New][COLOR=#007700]}else{ [/COLOR][/FONT]
[FONT=Courier New][COLOR=#007700]echo [/COLOR][COLOR=#dd0000]"&lt;p&gt;Errore!&lt;/p&gt;"[/COLOR][/FONT][FONT=Courier New][COLOR=#007700]; [/COLOR][/FONT]
[FONT=Courier New][COLOR=#007700]} [/COLOR][/FONT]
[FONT=Courier New][COLOR=#0000bb]?&gt;[/COLOR] [/FONT]
</code></pre>
<p dir="auto">il file form.html è questo</p>
<pre><code>[FONT=Courier New][COLOR=#007700]&lt;![/COLOR][COLOR=#0000bb]DOCTYPE html PUBLIC [/COLOR][COLOR=#dd0000]"-//W3C//DTD XHTML 1.0 Transitional//EN" ""[/COLOR][/FONT][FONT=Courier New][COLOR=#007700]&gt; [/COLOR][/FONT]
[FONT=Courier New][COLOR=#007700]&lt;[/COLOR][COLOR=#0000bb]html xmlns[/COLOR][COLOR=#007700]=[/COLOR][COLOR=#dd0000]""[/COLOR][/FONT][FONT=Courier New][COLOR=#007700]&gt; [/COLOR][/FONT]
[FONT=Courier New][COLOR=#007700]&lt;[/COLOR][COLOR=#0000bb]head[/COLOR][/FONT][FONT=Courier New][COLOR=#007700]&gt; [/COLOR][/FONT]
[FONT=Courier New][COLOR=#007700]&lt;[/COLOR][COLOR=#0000bb]meta http[/COLOR][COLOR=#007700]-[/COLOR][COLOR=#0000bb]equiv[/COLOR][COLOR=#007700]=[/COLOR][COLOR=#dd0000]"Content-Type" [/COLOR][COLOR=#0000bb]content[/COLOR][COLOR=#007700]=[/COLOR][COLOR=#dd0000]"text/html; charset=iso-8859-1" [/COLOR][/FONT][FONT=Courier New][COLOR=#007700]/&gt; [/COLOR][/FONT]
[FONT=Courier New][COLOR=#007700]&lt;[/COLOR][COLOR=#0000bb]title[/COLOR][COLOR=#007700]&gt;[/COLOR][COLOR=#0000bb]Form mail[/COLOR][COLOR=#007700]&lt;/[/COLOR][COLOR=#0000bb]title[/COLOR][/FONT][FONT=Courier New][COLOR=#007700]&gt; [/COLOR][/FONT]
 
[FONT=Courier New][COLOR=#007700]&lt;[/COLOR][COLOR=#0000bb]script type[/COLOR][COLOR=#007700]=[/COLOR][COLOR=#dd0000]"text/javascript" [/COLOR][COLOR=#0000bb]language[/COLOR][COLOR=#007700]=[/COLOR][COLOR=#dd0000]"javascript"[/COLOR][/FONT][FONT=Courier New][COLOR=#007700]&gt; [/COLOR][/FONT]
[FONT=Courier New][COLOR=#007700]function [/COLOR][COLOR=#0000bb]valida[/COLOR][/FONT][FONT=Courier New][COLOR=#007700](){ [/COLOR][/FONT]
[FONT=Courier New][COLOR=#007700]if (![/COLOR][COLOR=#0000bb]confirm[/COLOR][COLOR=#007700]([/COLOR][COLOR=#dd0000]'Confermi i dati inseriti?'[/COLOR][COLOR=#007700])) return [/COLOR][COLOR=#0000bb]false[/COLOR][/FONT][FONT=Courier New][COLOR=#007700]; [/COLOR][/FONT]
 
[FONT=Courier New][COLOR=#007700]if ([/COLOR][COLOR=#0000bb]document[/COLOR][COLOR=#007700].[/COLOR][COLOR=#0000bb]getElementById[/COLOR][COLOR=#007700]([/COLOR][COLOR=#dd0000]'nome'[/COLOR][COLOR=#007700]).[/COLOR][COLOR=#0000bb]value[/COLOR][COLOR=#007700]==[/COLOR][COLOR=#dd0000]''[/COLOR][/FONT][FONT=Courier New][COLOR=#007700]) { [/COLOR][/FONT]
[FONT=Courier New][COLOR=#0000bb]alert[/COLOR][COLOR=#007700]([/COLOR][COLOR=#dd0000]'Compilare correttamente il campo Nome!'[/COLOR][/FONT][FONT=Courier New][COLOR=#007700]); [/COLOR][/FONT]
[FONT=Courier New][COLOR=#0000bb]document[/COLOR][COLOR=#007700].[/COLOR][COLOR=#0000bb]getElementById[/COLOR][COLOR=#007700]([/COLOR][COLOR=#dd0000]'nome'[/COLOR][COLOR=#007700]).[/COLOR][COLOR=#0000bb]focus[/COLOR][/FONT][FONT=Courier New][COLOR=#007700](); [/COLOR][/FONT]
[FONT=Courier New][COLOR=#007700]return [/COLOR][COLOR=#0000bb]false[/COLOR][/FONT][FONT=Courier New][COLOR=#007700]; [/COLOR][/FONT]
[FONT=Courier New][COLOR=#007700]} [/COLOR][/FONT]
 
[FONT=Courier New][COLOR=#007700]if ([/COLOR][COLOR=#0000bb]document[/COLOR][COLOR=#007700].[/COLOR][COLOR=#0000bb]getElementById[/COLOR][COLOR=#007700]([/COLOR][COLOR=#dd0000]'cognome'[/COLOR][COLOR=#007700]).[/COLOR][COLOR=#0000bb]value[/COLOR][COLOR=#007700]==[/COLOR][COLOR=#dd0000]''[/COLOR][/FONT][FONT=Courier New][COLOR=#007700]) { [/COLOR][/FONT]
[FONT=Courier New][COLOR=#0000bb]alert[/COLOR][COLOR=#007700]([/COLOR][COLOR=#dd0000]'Compilare correttamente il campo Cognome!'[/COLOR][/FONT][FONT=Courier New][COLOR=#007700]); [/COLOR][/FONT]
[FONT=Courier New][COLOR=#0000bb]document[/COLOR][COLOR=#007700].[/COLOR][COLOR=#0000bb]getElementById[/COLOR][COLOR=#007700]([/COLOR][COLOR=#dd0000]'cognome'[/COLOR][COLOR=#007700]).[/COLOR][COLOR=#0000bb]focus[/COLOR][/FONT][FONT=Courier New][COLOR=#007700](); [/COLOR][/FONT]
[FONT=Courier New][COLOR=#007700]return [/COLOR][COLOR=#0000bb]false[/COLOR][/FONT][FONT=Courier New][COLOR=#007700]; [/COLOR][/FONT]
[FONT=Courier New][COLOR=#007700]} [/COLOR][/FONT]
 
[FONT=Courier New][COLOR=#007700]if ([/COLOR][COLOR=#0000bb]document[/COLOR][COLOR=#007700].[/COLOR][COLOR=#0000bb]getElementById[/COLOR][COLOR=#007700]([/COLOR][COLOR=#dd0000]'mail'[/COLOR][COLOR=#007700]).[/COLOR][COLOR=#0000bb]value[/COLOR][COLOR=#007700]==[/COLOR][COLOR=#dd0000]''[/COLOR][/FONT][FONT=Courier New][COLOR=#007700]) { [/COLOR][/FONT]
[FONT=Courier New][COLOR=#0000bb]alert[/COLOR][COLOR=#007700]([/COLOR][COLOR=#dd0000]'Compilare correttamente il campo Mail!'[/COLOR][/FONT][FONT=Courier New][COLOR=#007700]); [/COLOR][/FONT]
[FONT=Courier New][COLOR=#0000bb]document[/COLOR][COLOR=#007700].[/COLOR][COLOR=#0000bb]getElementById[/COLOR][COLOR=#007700]([/COLOR][COLOR=#dd0000]'mail'[/COLOR][COLOR=#007700]).[/COLOR][COLOR=#0000bb]focus[/COLOR][/FONT][FONT=Courier New][COLOR=#007700](); [/COLOR][/FONT]
[FONT=Courier New][COLOR=#007700]return [/COLOR][COLOR=#0000bb]false[/COLOR][/FONT][FONT=Courier New][COLOR=#007700]; [/COLOR][/FONT]
[FONT=Courier New][COLOR=#007700]} [/COLOR][/FONT]
 
[FONT=Courier New][COLOR=#007700]if ([/COLOR][COLOR=#0000bb]document[/COLOR][COLOR=#007700].[/COLOR][COLOR=#0000bb]getElementById[/COLOR][COLOR=#007700]([/COLOR][COLOR=#dd0000]'citta'[/COLOR][COLOR=#007700]).[/COLOR][COLOR=#0000bb]value[/COLOR][COLOR=#007700]==[/COLOR][COLOR=#dd0000]''[/COLOR][/FONT][FONT=Courier New][COLOR=#007700]) { [/COLOR][/FONT]
[FONT=Courier New][COLOR=#0000bb]alert[/COLOR][COLOR=#007700]([/COLOR][COLOR=#dd0000]'Compilare correttamente il campo Città!'[/COLOR][/FONT][FONT=Courier New][COLOR=#007700]); [/COLOR][/FONT]
[FONT=Courier New][COLOR=#0000bb]document[/COLOR][COLOR=#007700].[/COLOR][COLOR=#0000bb]getElementById[/COLOR][COLOR=#007700]([/COLOR][COLOR=#dd0000]'citta'[/COLOR][COLOR=#007700]).[/COLOR][COLOR=#0000bb]focus[/COLOR][/FONT][FONT=Courier New][COLOR=#007700](); [/COLOR][/FONT]
[FONT=Courier New][COLOR=#007700]return [/COLOR][COLOR=#0000bb]false[/COLOR][/FONT][FONT=Courier New][COLOR=#007700]; [/COLOR][/FONT]
[FONT=Courier New][COLOR=#007700]} [/COLOR][/FONT]
 
[FONT=Courier New][COLOR=#007700]if ([/COLOR][COLOR=#0000bb]document[/COLOR][COLOR=#007700].[/COLOR][COLOR=#0000bb]getElementById[/COLOR][COLOR=#007700]([/COLOR][COLOR=#dd0000]'telefono'[/COLOR][COLOR=#007700]).[/COLOR][COLOR=#0000bb]value[/COLOR][COLOR=#007700]==[/COLOR][COLOR=#dd0000]''[/COLOR][/FONT][FONT=Courier New][COLOR=#007700]) { [/COLOR][/FONT]
[FONT=Courier New][COLOR=#0000bb]alert[/COLOR][COLOR=#007700]([/COLOR][COLOR=#dd0000]'Compilare correttamente il campo Telefono!'[/COLOR][/FONT][FONT=Courier New][COLOR=#007700]); [/COLOR][/FONT]
[FONT=Courier New][COLOR=#0000bb]document[/COLOR][COLOR=#007700].[/COLOR][COLOR=#0000bb]getElementById[/COLOR][COLOR=#007700]([/COLOR][COLOR=#dd0000]'telefono'[/COLOR][COLOR=#007700]).[/COLOR][COLOR=#0000bb]focus[/COLOR][/FONT][FONT=Courier New][COLOR=#007700](); [/COLOR][/FONT]
[FONT=Courier New][COLOR=#007700]return [/COLOR][COLOR=#0000bb]false[/COLOR][/FONT][FONT=Courier New][COLOR=#007700]; [/COLOR][/FONT]
[FONT=Courier New][COLOR=#007700]} [/COLOR][/FONT]
 
[FONT=Courier New][COLOR=#007700]if ([/COLOR][COLOR=#0000bb]document[/COLOR][COLOR=#007700].[/COLOR][COLOR=#0000bb]getElementById[/COLOR][COLOR=#007700]([/COLOR][COLOR=#dd0000]'codice_fiscale'[/COLOR][COLOR=#007700]).[/COLOR][COLOR=#0000bb]value[/COLOR][COLOR=#007700]==[/COLOR][COLOR=#dd0000]''[/COLOR][/FONT][FONT=Courier New][COLOR=#007700]) { [/COLOR][/FONT]
[FONT=Courier New][COLOR=#0000bb]alert[/COLOR][COLOR=#007700]([/COLOR][COLOR=#dd0000]'Compilare correttamente il campo Codice_fiscale!'[/COLOR][/FONT][FONT=Courier New][COLOR=#007700]); [/COLOR][/FONT]
[FONT=Courier New][COLOR=#0000bb]document[/COLOR][COLOR=#007700].[/COLOR][COLOR=#0000bb]getElementById[/COLOR][COLOR=#007700]([/COLOR][COLOR=#dd0000]'codice_fiscale'[/COLOR][COLOR=#007700]).[/COLOR][COLOR=#0000bb]focus[/COLOR][/FONT][FONT=Courier New][COLOR=#007700](); [/COLOR][/FONT]
[FONT=Courier New][COLOR=#007700]return [/COLOR][COLOR=#0000bb]false[/COLOR][/FONT][FONT=Courier New][COLOR=#007700]; [/COLOR][/FONT]
[FONT=Courier New][COLOR=#007700]} [/COLOR][/FONT]
 
[FONT=Courier New][COLOR=#007700]if ([/COLOR][COLOR=#0000bb]document[/COLOR][COLOR=#007700].[/COLOR][COLOR=#0000bb]getElementById[/COLOR][COLOR=#007700]([/COLOR][COLOR=#dd0000]'p_iva'[/COLOR][COLOR=#007700]).[/COLOR][COLOR=#0000bb]value[/COLOR][COLOR=#007700]==[/COLOR][COLOR=#dd0000]''[/COLOR][/FONT][FONT=Courier New][COLOR=#007700]) { [/COLOR][/FONT]
[FONT=Courier New][COLOR=#0000bb]alert[/COLOR][COLOR=#007700]([/COLOR][COLOR=#dd0000]'Compilare correttamente il campo P_iva!'[/COLOR][/FONT][FONT=Courier New][COLOR=#007700]); [/COLOR][/FONT]
[FONT=Courier New][COLOR=#0000bb]document[/COLOR][COLOR=#007700].[/COLOR][COLOR=#0000bb]getElementById[/COLOR][COLOR=#007700]([/COLOR][COLOR=#dd0000]'p_iva'[/COLOR][COLOR=#007700]).[/COLOR][COLOR=#0000bb]focus[/COLOR][/FONT][FONT=Courier New][COLOR=#007700](); [/COLOR][/FONT]
[FONT=Courier New][COLOR=#007700]return [/COLOR][COLOR=#0000bb]false[/COLOR][/FONT][FONT=Courier New][COLOR=#007700]; [/COLOR][/FONT]
[FONT=Courier New][COLOR=#007700]} [/COLOR][/FONT]
 
 
[FONT=Courier New][COLOR=#007700]return [/COLOR][COLOR=#0000bb]true[/COLOR][/FONT][FONT=Courier New][COLOR=#007700]; [/COLOR][/FONT]
[FONT=Courier New][COLOR=#007700]}[/COLOR][/FONT][FONT=Courier New][COLOR=#ff8000]//valida [/COLOR][/FONT]
[FONT=Courier New][COLOR=#0000bb]&lt;/script&gt; [/COLOR][/FONT]
 
[FONT=Courier New]&lt;/head&gt; [/FONT]
 
[FONT=Courier New]&lt;body&gt; [/FONT]
[FONT=Courier New]&lt;form action="invio.php" method="post" enctype="multipart/form-data" onsubmit="return valida();"&gt; [/FONT]
[FONT=Courier New]&lt;input type="hidden" name="destinatario" value="emailmia"&gt; [/FONT]
[FONT=Courier New]&lt;table align="center" width="600" cellpadding="2" cellspacing="2"&gt; [/FONT]
[FONT=Courier New]&lt;tr&gt; [/FONT]
[FONT=Courier New]&lt;td&gt;Nome *&lt;/td&gt; [/FONT]
[FONT=Courier New]&lt;td&gt;&lt;input type="text" name="nome" id="nome" size="30" maxlength="100" /&gt;&lt;/td&gt; [/FONT]
[FONT=Courier New]&lt;/tr&gt; [/FONT]
[FONT=Courier New]&lt;tr&gt; [/FONT]
[FONT=Courier New]&lt;td&gt;Cognome *&lt;/td&gt; [/FONT]
[FONT=Courier New]&lt;td&gt;&lt;input type="text" name="cognome" id="cognome" size="30" maxlength="100" /&gt;&lt;/td&gt; [/FONT]
[FONT=Courier New]&lt;/tr&gt; [/FONT]
[FONT=Courier New]&lt;tr&gt; [/FONT]
[FONT=Courier New]&lt;td&gt;Oggetto&lt;/td&gt; [/FONT]
[FONT=Courier New]&lt;td&gt;&lt;input name="oggetto" type="text" id="oggetto" value="oggetto" size="30" maxlength="100" /&gt;&lt;/td&gt; [/FONT]
[FONT=Courier New]&lt;/tr&gt; [/FONT]
[FONT=Courier New]&lt;tr&gt; [/FONT]
[FONT=Courier New]&lt;td&gt;Mail *&lt;/td&gt; [/FONT]
[FONT=Courier New]&lt;td&gt;&lt;input type="text" name="mail" id="mail" size="30" maxlength="100" /&gt;&lt;/td&gt; [/FONT]
[FONT=Courier New]&lt;/tr&gt; [/FONT]
[FONT=Courier New]&lt;tr&gt; [/FONT]
[FONT=Courier New]&lt;td&gt;Città *&lt;/td&gt; [/FONT]
[FONT=Courier New]&lt;td&gt;&lt;input type="text" name="citta" id="citta" size="30" maxlength="100" /&gt;&lt;/td&gt; [/FONT]
[FONT=Courier New]&lt;/tr&gt; [/FONT]
[FONT=Courier New]&lt;tr&gt; [/FONT]
[FONT=Courier New]&lt;td&gt;Telefono *&lt;/td&gt; [/FONT]
[FONT=Courier New]&lt;td&gt;&lt;input type="text" name="telefono" id="telefono" size="30" maxlength="100" /&gt;&lt;/td&gt; [/FONT]
[FONT=Courier New]&lt;/tr&gt; [/FONT]
[FONT=Courier New]&lt;tr&gt; [/FONT]
[FONT=Courier New]&lt;td&gt;Codice fiscale *&lt;/td&gt; [/FONT]
[FONT=Courier New]&lt;td&gt;&lt;input type="text" name="codice_fiscale" id="codice_fiscale" size="30" maxlength="100" /&gt;&lt;/td&gt; [/FONT]
[FONT=Courier New]&lt;/tr&gt; [/FONT]
[FONT=Courier New]&lt;tr&gt; [/FONT]
[FONT=Courier New]&lt;td&gt;P iva *&lt;/td&gt; [/FONT]
[FONT=Courier New]&lt;td&gt;&lt;input type="text" name="p_iva" id="p_iva" size="30" maxlength="100" /&gt;&lt;/td&gt; [/FONT]
[FONT=Courier New]&lt;/tr&gt; [/FONT]
[FONT=Courier New]&lt;tr&gt; [/FONT]
[FONT=Courier New]&lt;td&gt;Allegato *&lt;br /&gt; [/FONT]
[FONT=Courier New]&lt;/td&gt; [/FONT]
[FONT=Courier New]&lt;td&gt;&lt;input type="file" name="allegato" id="allegato" /&gt;&lt;/td&gt; [/FONT]
[FONT=Courier New]&lt;/tr&gt; [/FONT]
[FONT=Courier New]&lt;/table&gt; [/FONT]
[FONT=Courier New]&lt;div align="center"&gt; [/FONT]
[FONT=Courier New]&lt;input type="submit" value="Invia dati" /&gt; [/FONT]
[FONT=Courier New]&lt;/div&gt; [/FONT]
[FONT=Courier New]&lt;/form&gt; [/FONT]
[FONT=Courier New]&lt;/body&gt; [/FONT]
[FONT=Courier New]&lt;/html&gt;[/FONT]
</code></pre>
<p dir="auto">Il problema è che se io mando la mail con allegato allora vedo sia l'allegato inserito sia i dati inseriti, se invece invio senza allegato la mail che arriva è completamente vuota.<br />
Potete aiutarmi gentilmente?<br />
Mi spiego meglio:<br />
Io voglio che sia con allegato sia senza allegato, i dati inseriti arrivino correttamente quando ricevo la mail. Attualmente cosi come è ricevo i dati SOLO se viene inserito l'allegato.<br />
Potete aiutarmi?</p>
]]></description><link>https://dev.connect.gt/topic/114363/problema-form-php</link><generator>RSS for Node</generator><lastBuildDate>Thu, 26 Nov 2026 07:15:50 GMT</lastBuildDate><atom:link href="https://dev.connect.gt/topic/114363.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 05 Nov 2009 13:27:54 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Problema form php on Thu, 05 Nov 2009 23:24:34 GMT]]></title><description><![CDATA[<p dir="auto">Devi gestire anche il caso in cui non ci sia l'allegato<br />
sostituisci</p>
<pre><code>[FONT=Courier New][COLOR=#007700]else [/COLOR][/FONT]
[FONT=Courier New][COLOR=#007700]{ [/COLOR][/FONT]
[FONT=Courier New][COLOR=#007700]   echo [/COLOR][COLOR=#dd0000]"&lt;p&gt;Errore!&lt;/p&gt;"[/COLOR][/FONT][FONT=Courier New][COLOR=#007700]; [/COLOR][/FONT]
[FONT=Courier New][COLOR=#007700]} [/COLOR][/FONT]
</code></pre>
<p dir="auto">con</p>
<pre><code>[FONT=Courier New][COLOR=#007700]else [/COLOR][/FONT]
[FONT=Courier New][COLOR=#007700]{ [/COLOR][/FONT]
[FONT=Courier New][COLOR=#0000bb]   $msg [/COLOR][COLOR=#007700].= [/COLOR][COLOR=#0000bb]$messaggio;[/COLOR][/FONT]
[FONT=Courier New][COLOR=#007700]} [/COLOR][/FONT]
</code></pre>
]]></description><link>https://dev.connect.gt/post/870297</link><guid isPermaLink="true">https://dev.connect.gt/post/870297</guid><dc:creator><![CDATA[artechbrand]]></dc:creator><pubDate>Thu, 05 Nov 2009 23:24:34 GMT</pubDate></item></channel></rss>