Salta al contenuto
  • CATEGORIES
  • La Community Connect.gt
  • Presentati alla Community
  • News Ufficiali da Connect.gt
  • Internet News
  • A Scuola Di
  • Digital Marketing
  • Intelligenza Artificiale
  • SEO & GEO
  • Web Marketing e Content
  • Google Analytics e Web Analytics
  • Google Ads & Advertising
  • YouTube
  • TikTok, Instagram e altri Social
  • Google Adsense, Affiliazioni e Guadagno
  • E-Commerce
  • Coding e Sistemistica
  • Help Center: consigli per il tuo progetto
  • Hosting e Cloud
  • Coding
  • CMS & Piattaforme Self-Hosted
  • Annunci e Collaborazioni
  • Annunci Vendita e Acquisto: Pubblicità, Domini, Link e altro
  • Collaborazioni WEB e Lavoro: offro e cerco
  • Impresa, Fisco e Leggi
  • Consulenza Legale e Professioni Web
  • Consulenza Fiscale, Imprese, Startup e P.Iva
  • Gli Off Topic
  • PC, Smartphone e altri Hardware
  • Tutti i Software
  • GT Fetish Cafè
  • Discussioni
  • 0 Non letti 0
  • Recenti
  • Hashtag
  • Popolare
  • Utenti
  • Privacy
  • Termini e condizioni
  • © 2026 Search On Media Group S.r.l.
Collassa
Connect.gt
Il network Search On
Connect.gt WMF AI Festival Accademia Advanced SEO Tool AgentCy Social Media Strategies Search Tech
Registrati Accedi
Connect.gt
Stream Interest Categorie Hashtag
  1. La community italiana di SEO, marketing digitale e AI
  2. Categorie
  3. Coding e Sistemistica
  4. Coding
  5. Problema form php

Problema form php

Pianificato Fissato Bloccato Spostato Coding
2 Post 2 Autori 754 Visualizzazioni 1 Seguito
  • Da Vecchi a Nuovi
  • Da Nuovi a Vecchi
  • Più Voti
Rispondi
  • Risposta alla discussione
Effettua l'accesso per rispondere
Questa discussione è stata eliminata. Solo gli utenti con diritti di gestione possono vederla.
  • D
    D
    danielino81
    scritto su ultima modifica di
    User Newbie 0
    #1
    Problema form php

    Salve a tutti!Vi chiedo cortesemente un grande favore,non essendo esperto di php.
    Devo creare un form mail che abbia i campi obbligatori e che permetta anche di allegare un file (qualsiasi).
    Il suo contenuto deve essere più o meno così :
    Nome*
    Cognome*
    Mail*
    Città
    Telefono*
    Codice fiscale*
    Partita Iva*
    Allega file*

    *= campi obbligatori

    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.
    Io voglio che anche non inserendo l'allegato l'email venga vista correttamente con tutti i suoi dati.
    E' possibile?

    Vi posto il codice php che ho utilizzato

    [FONT=Courier New][COLOR=#0000bb]<?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]"<p>Errore!</p>"[/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]"<p>Mail inviata con successo!</p>"[/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]"<p>Errore!</p>"[/COLOR][/FONT][FONT=Courier New][COLOR=#007700]; [/COLOR][/FONT]
    [FONT=Courier New][COLOR=#007700]} [/COLOR][/FONT]
    [FONT=Courier New][COLOR=#0000bb]?>[/COLOR] [/FONT]
    

    il file form.html è questo

    [FONT=Courier New][COLOR=#007700]<![/COLOR][COLOR=#0000bb]DOCTYPE html PUBLIC [/COLOR][COLOR=#dd0000]"-//W3C//DTD XHTML 1.0 Transitional//EN" ""[/COLOR][/FONT][FONT=Courier New][COLOR=#007700]> [/COLOR][/FONT]
    [FONT=Courier New][COLOR=#007700]<[/COLOR][COLOR=#0000bb]html xmlns[/COLOR][COLOR=#007700]=[/COLOR][COLOR=#dd0000]""[/COLOR][/FONT][FONT=Courier New][COLOR=#007700]> [/COLOR][/FONT]
    [FONT=Courier New][COLOR=#007700]<[/COLOR][COLOR=#0000bb]head[/COLOR][/FONT][FONT=Courier New][COLOR=#007700]> [/COLOR][/FONT]
    [FONT=Courier New][COLOR=#007700]<[/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]/> [/COLOR][/FONT]
    [FONT=Courier New][COLOR=#007700]<[/COLOR][COLOR=#0000bb]title[/COLOR][COLOR=#007700]>[/COLOR][COLOR=#0000bb]Form mail[/COLOR][COLOR=#007700]</[/COLOR][COLOR=#0000bb]title[/COLOR][/FONT][FONT=Courier New][COLOR=#007700]> [/COLOR][/FONT]
     
    [FONT=Courier New][COLOR=#007700]<[/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]> [/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]</script> [/COLOR][/FONT]
     
    [FONT=Courier New]</head> [/FONT]
     
    [FONT=Courier New]<body> [/FONT]
    [FONT=Courier New]<form action="invio.php" method="post" enctype="multipart/form-data" onsubmit="return valida();"> [/FONT]
    [FONT=Courier New]<input type="hidden" name="destinatario" value="emailmia"> [/FONT]
    [FONT=Courier New]<table align="center" width="600" cellpadding="2" cellspacing="2"> [/FONT]
    [FONT=Courier New]<tr> [/FONT]
    [FONT=Courier New]<td>Nome *</td> [/FONT]
    [FONT=Courier New]<td><input type="text" name="nome" id="nome" size="30" maxlength="100" /></td> [/FONT]
    [FONT=Courier New]</tr> [/FONT]
    [FONT=Courier New]<tr> [/FONT]
    [FONT=Courier New]<td>Cognome *</td> [/FONT]
    [FONT=Courier New]<td><input type="text" name="cognome" id="cognome" size="30" maxlength="100" /></td> [/FONT]
    [FONT=Courier New]</tr> [/FONT]
    [FONT=Courier New]<tr> [/FONT]
    [FONT=Courier New]<td>Oggetto</td> [/FONT]
    [FONT=Courier New]<td><input name="oggetto" type="text" id="oggetto" value="oggetto" size="30" maxlength="100" /></td> [/FONT]
    [FONT=Courier New]</tr> [/FONT]
    [FONT=Courier New]<tr> [/FONT]
    [FONT=Courier New]<td>Mail *</td> [/FONT]
    [FONT=Courier New]<td><input type="text" name="mail" id="mail" size="30" maxlength="100" /></td> [/FONT]
    [FONT=Courier New]</tr> [/FONT]
    [FONT=Courier New]<tr> [/FONT]
    [FONT=Courier New]<td>Città *</td> [/FONT]
    [FONT=Courier New]<td><input type="text" name="citta" id="citta" size="30" maxlength="100" /></td> [/FONT]
    [FONT=Courier New]</tr> [/FONT]
    [FONT=Courier New]<tr> [/FONT]
    [FONT=Courier New]<td>Telefono *</td> [/FONT]
    [FONT=Courier New]<td><input type="text" name="telefono" id="telefono" size="30" maxlength="100" /></td> [/FONT]
    [FONT=Courier New]</tr> [/FONT]
    [FONT=Courier New]<tr> [/FONT]
    [FONT=Courier New]<td>Codice fiscale *</td> [/FONT]
    [FONT=Courier New]<td><input type="text" name="codice_fiscale" id="codice_fiscale" size="30" maxlength="100" /></td> [/FONT]
    [FONT=Courier New]</tr> [/FONT]
    [FONT=Courier New]<tr> [/FONT]
    [FONT=Courier New]<td>P iva *</td> [/FONT]
    [FONT=Courier New]<td><input type="text" name="p_iva" id="p_iva" size="30" maxlength="100" /></td> [/FONT]
    [FONT=Courier New]</tr> [/FONT]
    [FONT=Courier New]<tr> [/FONT]
    [FONT=Courier New]<td>Allegato *<br /> [/FONT]
    [FONT=Courier New]</td> [/FONT]
    [FONT=Courier New]<td><input type="file" name="allegato" id="allegato" /></td> [/FONT]
    [FONT=Courier New]</tr> [/FONT]
    [FONT=Courier New]</table> [/FONT]
    [FONT=Courier New]<div align="center"> [/FONT]
    [FONT=Courier New]<input type="submit" value="Invia dati" /> [/FONT]
    [FONT=Courier New]</div> [/FONT]
    [FONT=Courier New]</form> [/FONT]
    [FONT=Courier New]</body> [/FONT]
    [FONT=Courier New]</html>[/FONT]
    

    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.
    Potete aiutarmi gentilmente?
    Mi spiego meglio:
    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.
    Potete aiutarmi?

    1 Risposta Ultima Risposta
    Miglior risposta 0
    0
    • A
      A
      artechbrand
      scritto su ultima modifica di
      User 0
      #2

      Devi gestire anche il caso in cui non ci sia l'allegato
      sostituisci

      [FONT=Courier New][COLOR=#007700]else [/COLOR][/FONT]
      [FONT=Courier New][COLOR=#007700]{ [/COLOR][/FONT]
      [FONT=Courier New][COLOR=#007700]   echo [/COLOR][COLOR=#dd0000]"<p>Errore!</p>"[/COLOR][/FONT][FONT=Courier New][COLOR=#007700]; [/COLOR][/FONT]
      [FONT=Courier New][COLOR=#007700]} [/COLOR][/FONT]
      

      con

      [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]
      
      1 Risposta Ultima Risposta
      Miglior risposta 0
      0

      Ciao! Sembra che tu sia interessato a questa conversazione, ma non hai ancora un account.

      Stanco di dover scorrere gli stessi post a ogni visita? Quando registri un account, tornerai sempre esattamente dove eri rimasto e potrai scegliere di essere avvisato delle nuove risposte (tramite email o notifica push). Potrai anche salvare segnalibri e votare i post per mostrare il tuo apprezzamento agli altri membri della comunità.

      Con il tuo contributo, questo post potrebbe essere ancora migliore 💗

      Registrati Accedi
      Rispondi
      • Risposta alla discussione
      Effettua l'accesso per rispondere
      • Da Vecchi a Nuovi
      • Da Nuovi a Vecchi
      • Più Voti


      • Accedi

      • Non hai un account? Registrati

      • Accedi o registrati per effettuare la ricerca.
      • Primo post
        Ultimo post
      Home Accedi Registrati
      Menu
      • CATEGORIES
      • La Community Connect.gt
      • Presentati alla Community
      • News Ufficiali da Connect.gt
      • Internet News
      • A Scuola Di
      • Digital Marketing
      • Intelligenza Artificiale
      • SEO & GEO
      • Web Marketing e Content
      • Google Analytics e Web Analytics
      • Google Ads & Advertising
      • YouTube
      • TikTok, Instagram e altri Social
      • Google Adsense, Affiliazioni e Guadagno
      • E-Commerce
      • Coding e Sistemistica
      • Help Center: consigli per il tuo progetto
      • Hosting e Cloud
      • Coding
      • CMS & Piattaforme Self-Hosted
      • Annunci e Collaborazioni
      • Annunci Vendita e Acquisto: Pubblicità, Domini, Link e altro
      • Collaborazioni WEB e Lavoro: offro e cerco
      • Impresa, Fisco e Leggi
      • Consulenza Legale e Professioni Web
      • Consulenza Fiscale, Imprese, Startup e P.Iva
      • Gli Off Topic
      • PC, Smartphone e altri Hardware
      • Tutti i Software
      • GT Fetish Cafè
      • Discussioni
      • Non letti 0
      • Recenti
      • Hashtag
      • Popolare
      • Utenti
      • Privacy
      • Termini e condizioni
      • © 2026 Search On Media Group S.r.l.