• Home
  • Forum
  • Fare Web
  • PHP

Form con campi obbligatori

  • Creatore Discussione Creatore Discussione ::silver73::
  • Data di inizio Data di inizio 26 Set 2012
  • Tag Tag
    campi obbligatori form php
Prec.
  • 1
  • 2
  • 3
Succ.
Primo Prec. 2 di 3 Succ. Ultimo
S

::silver73::

Nuovo Utente
26 Set 2012
19
0
0
  • 1 Ott 2012
  • #21
Perfetto, l'ho testato e così mi pare che funzioni alla perfezione anche se ho lasciato nel codice la parte riguardante la privacy che invece dal form è stata eliminata. Potrei toglierla per una questione di pulizia del codice ma temo di far danni!!!

Ho lasciato tutto così:
PHP:
if (isset($_POST['submit']) && $_POST['submit'] == "submit") {
    // inizializzo campi obbligatori
    $obbligatorio = array();
    // eliminiamo il post submit 
    unset($_POST['submit']);
    // ciclo del POST
    
  // se sceglie no 
        if ($_POST['selfCandidature'] == 'no') { 
            // lo cancelliamo per non ciclarlo 
            unset($_POST['expertise']); 
        } 
    
   foreach ($_POST as $key => $value) {
        // se non è vuoto
       if (!empty($value)) { 
     //       // minimo controllo
            ${$_POST[$key]} = htmlentities($value);
           if ($privacy == "no") {
                $obbligatorio[] = "E' obbligatorio accettare le condizioni sulla privacy";
               break;
           }
      } else {
           $obbligatorio[] = "\nIl campo $key e' obbligatorio";
}
	}

Nei controlli che vengono fatti con questo codice però, non sono inclusi 5 checkbox perchè anche se non spunto la casella non mi dice che sono obbligatori e invece dovrebbero esserlo anche loro. In HTML appaiono così:

HTML:
The article is original <input type="checkbox" name="original" id="original" value="yes"><br/>
The article obeys to the ethical code <input type="checkbox" name="ethicalCode" id="ethicalCode" value="yes"><br/>
The author accepts the rules about the copyright <input type="checkbox" name="copyright" id="copyright" value="yes"><br/>
The author accepts the rules concerning the page charge (if due) <input type="checkbox" name="charge" id="charge" value="yes"><br/>
The article will be anonymously peer reviewed <input type="checkbox" name="peerReview" id="peerReview" value="yes"><br/>

devo aggiungere qualcosa in questa parte di codice o riguarda anche questo il file php?
 

criric

Super Moderatore
Membro dello Staff
SUPER MOD
MOD
21 Ago 2010
5.606
54
48
TN
  • 1 Ott 2012
  • #22
puoi tranquillamente togliere tutto questo pezzo ( parentesi } comprese ) senza crear nessun danno
PHP:
if ($privacy == "no") {
                $obbligatorio[] = "E' obbligatorio accettare le condizioni sulla privacy";
               break;
           }

per i ceckbox intendi che almeno uno dei 5 deve essere spuntato?
 

criric

Super Moderatore
Membro dello Staff
SUPER MOD
MOD
21 Ago 2010
5.606
54
48
TN
  • 1 Ott 2012
  • #23
Se è come penso mi è venuta questa idea
creiamo un array che contiene i name delle check e lo cicliamo per vedere se almeno una è spuntata
riposto la prima parte del codice
PHP:
<?php
// se hanno premuto il pulsante submit
if (isset($_POST['submit']) && $_POST['submit'] == "submit") {
    // inizializzo campi obbligatori
    $obbligatorio = array();
    // eliminiamo il post submit 
    unset($_POST['submit']);
    // array ceck obbligatorie
    $array_check = array("original", "ethicalCode", "copyright", "charge", "peerReview");
    // inizializzo conteggio check
    $ck = 0;
    // ciclo array ceck obbligatorie
    foreach ($array_check as $value) {
        // se settata 
        if (isset($_POST[$value])) {
            // incremento
            $ck++;
        }
    }
    // se non ne trovo neanche una
    if ($ck == 0) {
        $obbligatorio[] = "Checkbox obbligatorie";
    }
    // se sceglie no 
    if ($_POST['selfCandidature'] == 'no') {
        // lo cancelliamo per non verificarlo 
        unset($_POST['expertise']);
    }
    // ciclo del POST
    foreach ($_POST as $key => $value) {
        // se non è vuoto
        if (!empty($value)) {
            // minimo controllo
            ${$_POST[$key]} = htmlentities($value);
        } else {
            $obbligatorio[] = "\nIl campo $key e' obbligatorio";
        }
    }
 
S

::silver73::

Nuovo Utente
26 Set 2012
19
0
0
  • 1 Ott 2012
  • #24
Ho provato il codice e funziona: se almeno una delle checkbox è spuntata l'invio della mail va a buon fine, solo che dovrebbero essere tutte obbligatorie, non c'è un modo semplice per rendere l'intero array obbligatorio???

Forse sto semplificando un po' troppo!!!!
 

criric

Super Moderatore
Membro dello Staff
SUPER MOD
MOD
21 Ago 2010
5.606
54
48
TN
  • 1 Ott 2012
  • #25
se è minore di 5
PHP:
if ($ck < 5) {
        $obbligatorio[] = "Checkbox obbligatorie";
    }
 
S

::silver73::

Nuovo Utente
26 Set 2012
19
0
0
  • 2 Ott 2012
  • #26
Avevo provato a risolvere inserendo istruzioni di verifica singola di ogni checkbox, ma andavano in conflitto l'una con l'altra restituendo a video messaggi come se ci fossero altri campi vuoti oltre alle stesse checkbox.

Ho dato un'occhiata alla parte di caricampento del file ma non riesco a capire perchèscinde completamente l'invio del file dall'invio degli altri dati; mi spiego: se i campi sono completati correttamente e il file non caricato invia comunque mail coi dati e a video appaiono righe di codice piuttosto che il messaggio di errore.

So che non è poco ma è l'ultimo pezzetto che non riesco a rimettere in sesto :dipser:
 

criric

Super Moderatore
Membro dello Staff
SUPER MOD
MOD
21 Ago 2010
5.606
54
48
TN
  • 2 Ott 2012
  • #27
Ciao,
riposta il codice aggiornato

con le check hai risolto? , non ho capito
 
Ultima modifica: 2 Ott 2012
S

::silver73::

Nuovo Utente
26 Set 2012
19
0
0
  • 2 Ott 2012
  • #28
Ciao,

si con le checkbox è stato sufficiente il cambiamento che mi hai suggerito e sembra che tutto funzioni.
Questo è il codice php aggiornato all'ultima versione:

PHP:
<?php 
// se hanno premuto il pulsante submit 
if (isset($_POST['submit']) && $_POST['submit'] == "submit") { 
    // inizializzo campi obbligatori 
    $obbligatorio = array(); 
    // eliminiamo il post submit  
    unset($_POST['submit']); 
    // array check obbligatorie 
    $array_check = array("original", "ethicalCode", "copyright", "charge", "peerReview"); 
    // inizializzo conteggio check 
    $ck = 0; 
    // ciclo array check obbligatorie 
    foreach ($array_check as $value) { 
        // se settata  
        if (isset($_POST[$value])) { 
            // incremento 
            $ck++; 
        } 
    } 
    // se non ne trovo neanche una 
    if ($ck < 5) { 
        $obbligatorio[] = "Checkbox obbligatorie"; 
    } 
    // se sceglie no  
    if ($_POST['selfCandidature'] == 'no') { 
        // lo cancelliamo per non verificarlo  
        unset($_POST['expertise']); 
    } 
    // ciclo del POST 
    foreach ($_POST as $key => $value) { 
        // se non è vuoto 
        if (!empty($value)) { 
            // minimo controllo 
            ${$_POST[$key]} = htmlentities($value); 
        } else { 
            $obbligatorio[] = "\nIl campo $key e' obbligatorio"; 
        } 
    }
		
    if (count($obbligatorio) == 0) {
        $header = "";
        $msg = "";
        $boundary = '--' . md5(uniqid(time()));
        $ctencoding = "8bit";
        $subject = "Submission of a new Article";
        $testo_del_messaggio = "Title: $title\n";
        $testo_del_messaggio.="Name: $name\n";
        $testo_del_messaggio.="Surname: $surname\n";
        $testo_del_messaggio.="Email: $email\n";
        $testo_del_messaggio.="Telephone: $telephone\n";
        $testo_del_messaggio.="Fax: $fax\n";
        $testo_del_messaggio.="Title of the Article: $titleArticle\n";
        $testo_del_messaggio.="Category: $category\n";
	$testo_del_messaggio.="Originality of the article: $original\n"; 
	$testo_del_messaggio.="Ethical Code: $ethicalCode\n"; 
	$testo_del_messaggio.="Rules of the copyright: $copyright\n"; 
	$testo_del_messaggio.="Rules of the page charge: $charge\n"; 
	$testo_del_messaggio.="Anonymous peer review: $peerReview\n"; 
        $testo_del_messaggio.="Self Candidature: $selfCandidature\n";
        $testo_del_messaggio.="Expertise: $expertise\n";
        $to = "dc@mail.com";
        $from = $_POST['email'];
        $fromname = $_POST['surname'];
        $ctype = "application/octet-stream";
        $basename = $_FILES['all']['tmp_name'];
        $name = $_FILES['all']['name'];
        $header.="From: \"$fromname\" <$from>\nReturn-Path: $from\nX-Priority: 3\nTo: $to\n";
        $header.="Mime-Version: 1.0\nContent-Type: multipart/mixed;  \n boundary=\"$boundary\"\n";
        $header.="Content-Transfer-Encoding: 8bit\n";
        $msg .="This is a multi-part message in MIME format.\n--$boundary\n";
        $msg .= "Content-Type: text/plain; charset=iso-8859-1\n";
        $msg .= "Content-Transfer-Encoding: 8bit\n\n" . $testo_del_messaggio . "\n";
        $msg .="--$boundary\nContent-type: $ctype;\n name=\"$name\"\n";
        $msg .="Content-Transfer-Encoding: base64\nContent-Disposition: attachment\n filename=\"$name\"\n";
        $linesz = filesize($basename) + 1;
        $fp = fopen($basename, 'r');
        $content = chunk_split(base64_encode(fread($fp, $linesz)));
        fclose($fp);
        $msg .= chr(13) . chr(10) . $content;
        $result = @mail($to, $subject, $msg . "\n", $header);
        if ($result) {
            echo "<p>Your data and your article have been successfully sent</p> <p>Thank you very much for your contribution!</p>";
        } else {
            echo " <p>Error.<br>Impossible to send the data.</p><p>Try once again.</p>";
        }
    } else {
        foreach ($obbligatorio as $value) {
            echo $value . "<br/>";
            echo "Torna al form";
        }
    }
} else {
    echo "Post non settato, pagina non accessibile";
}
?>

Il form è questo:

HTML:
<form name="personalContact" enctype="multipart/form-data" method="post" action="mail.php">
...
Select a file to upload:
  <input name="all" type="file" id="all"> 
...
<button type="reset">Reset</button>&nbsp;<button name="submit" value="submit" type="submit">Send</button>
</form>

Ho tolto il codice superfluo che sta in mezzo dei vari campi da compilare
 

criric

Super Moderatore
Membro dello Staff
SUPER MOD
MOD
21 Ago 2010
5.606
54
48
TN
  • 2 Ott 2012
  • #29
ora vado anchio per tentativi visto che non ho mai spedito un file via mail

potresti intanto verificare che il nome non sia vuoto
PHP:
// se diverso da vuoto
if ($basename != '') {
            $linesz = filesize($basename) + 1;
            $fp = fopen($basename, 'r');
            $content = chunk_split(base64_encode(fread($fp, $linesz)));
            fclose($fp);
            $msg .= chr(13) . chr(10) . $content;
        }
prova fami sapere
 

borgo italia

Super Moderatore
Membro dello Staff
SUPER MOD
MOD
4 Feb 2008
16.044
150
63
PR
www.borgo-italia.it
  • 2 Ott 2012
  • #30
ciao
se usate phpmailer spedire allegati è una stupidaggine
 
S

::silver73::

Nuovo Utente
26 Set 2012
19
0
0
  • 2 Ott 2012
  • #31
Ho provato inserendo il codice subito prima di questa riga

PHP:
if (count($obbligatorio) == 0)

ho riempito tutti i campi del form ma non ho caricato di proposito il fileper vedere qual è il messaggio che viene fuori, ed è questo:

Warning: fopen() [function.fopen]: Filename cannot be empty in D:\inetpub\webs\cdialcom\mail.php on line 91

Warning: fread(): supplied argument is not a valid stream resource in D:\inetpub\webs\cdialscom\mail.php on line 92

Warning: fclose(): supplied argument is not a valid stream resource in D:\inetpub\webs\cdialcom\mail.php on line 93
Your data and your article have been successfully sent

Thank you very much for your contribution!
Clicca per allargare...

la mail coi dati viene mandata in maniera corretta.

Magari ho sbagliato il posizionamento del codice...
 
S

::silver73::

Nuovo Utente
26 Set 2012
19
0
0
  • 2 Ott 2012
  • #32
borgo italia ha scritto:
ciao
se usate phpmailer spedire allegati è una stupidaggine
Clicca per allargare...

Ciao,
grazie per il suggerimento ma non avrei idea da dove cominciare e significherebbe smontare completamente il form di nuovo...
 

criric

Super Moderatore
Membro dello Staff
SUPER MOD
MOD
21 Ago 2010
5.606
54
48
TN
  • 2 Ott 2012
  • #33
ma il file è obbligatorio?

se si potresti aggiungere un altro controllo simile a quelli che abbiamo fatto fin ora

PHP:
if (empty($_FILES['all']['tmp_name'])) {
        $obbligatorio[] = "File obbligatorio";
    }
 
S

::silver73::

Nuovo Utente
26 Set 2012
19
0
0
  • 2 Ott 2012
  • #34
si, il file è obbligatorio e sembra che il tuo codice funzioni, ho fatto una prova e sembra che vada...

Questo è il codice finale aggiornato, se non ho sbagliato nel riportare qualcosa al posto giusto

PHP:
<?php 
// se hanno premuto il pulsante submit 
if (isset($_POST['submit']) && $_POST['submit'] == "submit") { 
    // inizializzo campi obbligatori 
    $obbligatorio = array(); 
    // eliminiamo il post submit  
    unset($_POST['submit']); 
    // array ceck obbligatorie 
    $array_check = array("original", "ethicalCode", "copyright", "charge", "peerReview"); 
    // inizializzo conteggio check 
    $ck = 0; 
    // ciclo array ceck obbligatorie 
    foreach ($array_check as $value) { 
        // se settata  
        if (isset($_POST[$value])) { 
            // incremento 
            $ck++; 
        } 
    } 
    // se non ne trovo neanche una 
    if ($ck < 5) { 
        $obbligatorio[] = "Checkbox obbligatorie"; 
    } 
    // se sceglie no  
    if ($_POST['selfCandidature'] == 'no') { 
        // lo cancelliamo per non verificarlo  
        unset($_POST['expertise']); 
    } 
    // ciclo del POST 
    foreach ($_POST as $key => $value) { 
        // se non è vuoto 
        if (!empty($value)) { 
            // minimo controllo 
            ${$_POST[$key]} = htmlentities($value); 
        } else { 
            $obbligatorio[] = "\nIl campo $key e' obbligatorio"; 
        } 
    }
	//tentativo per i checkbox ma è inutile una volta che ripeto la stessa dicitura per i 5 checkbox
	//in teoria il codice per includere più cambi è  ...empty($campo1) || empty($campo2) || empty($campo3)...
	//if (empty($original)){
	//$obbligatorio[] = "\nIl campo $key e' obbligatorio";
	//echo '<a href="java script:history.go(-1)">Torna indietro</a>';
	//} 
	
	// se diverso da vuoto
if ($basename != '') {
            $linesz = filesize($basename) + 1;
            $fp = fopen($basename, 'r');
            $content = chunk_split(base64_encode(fread($fp, $linesz)));
            fclose($fp);
            $msg .= chr(13) . chr(10) . $content;
        } 
if (empty($_FILES['all']['tmp_name'])) { 
        $obbligatorio[] = "File obbligatorio"; 
    }  
	
    if (count($obbligatorio) == 0) {
        $header = "";
        $msg = "";
        $boundary = '--' . md5(uniqid(time()));
        $ctencoding = "8bit";
        $subject = "Submission of a new Article";
        $testo_del_messaggio = "Title: $title\n";
        $testo_del_messaggio.="Name: $name\n";
        $testo_del_messaggio.="Surname: $surname\n";
        $testo_del_messaggio.="Email: $email\n";
        $testo_del_messaggio.="Telephone: $telephone\n";
        $testo_del_messaggio.="Fax: $fax\n";
        $testo_del_messaggio.="Title of the Article: $titleArticle\n";
        $testo_del_messaggio.="Category: $category\n";
	$testo_del_messaggio.="Originality of the article: $original\n"; 
	$testo_del_messaggio.="Ethical Code: $ethicalCode\n"; 
	$testo_del_messaggio.="Rules of the copyright: $copyright\n"; 
	$testo_del_messaggio.="Rules of the page charge: $charge\n"; 
	$testo_del_messaggio.="Anonymous peer review: $peerReview\n"; 
        $testo_del_messaggio.="Self Candidature: $selfCandidature\n";
        $testo_del_messaggio.="Expertise: $expertise\n";
        $to = "daniela.cardillo@gmail.com";
        $from = $_POST['email'];
        $fromname = $_POST['surname'];
        $ctype = "application/octet-stream";
        $basename = $_FILES['all']['tmp_name'];
        $name = $_FILES['all']['name'];
        $header.="From: \"$fromname\" <$from>\nReturn-Path: $from\nX-Priority: 3\nTo: $to\n";
        $header.="Mime-Version: 1.0\nContent-Type: multipart/mixed;  \n boundary=\"$boundary\"\n";
        $header.="Content-Transfer-Encoding: 8bit\n";
        $msg .="This is a multi-part message in MIME format.\n--$boundary\n";
        $msg .= "Content-Type: text/plain; charset=iso-8859-1\n";
        $msg .= "Content-Transfer-Encoding: 8bit\n\n" . $testo_del_messaggio . "\n";
        $msg .="--$boundary\nContent-type: $ctype;\n name=\"$name\"\n";
        $msg .="Content-Transfer-Encoding: base64\nContent-Disposition: attachment\n filename=\"$name\"\n";
        $linesz = filesize($basename) + 1;
        $fp = fopen($basename, 'r');
        $content = chunk_split(base64_encode(fread($fp, $linesz)));
        fclose($fp);
        $msg .= chr(13) . chr(10) . $content;
        $result = @mail($to, $subject, $msg . "\n", $header);
        if ($result) {
            echo "<p>Your data and your article have been successfully sent</p> <p>Thank you very much for your contribution!</p>";
        } else {
            echo " <p>Error.<br>Impossible to send the data.</p><p>Try once again.</p>";
        }
    } else {
        foreach ($obbligatorio as $value) {
            echo $value . "<br/>";
            echo "Torna al form";
        }
    }
} else {
    echo "Post non settato, pagina non accessibile";
}
?>

Credo ci siano parti di codice superflui ma non penso creino conflitti con la parte necessaria!!!!

Funzionaaaaaaa :mavieni:
 

criric

Super Moderatore
Membro dello Staff
SUPER MOD
MOD
21 Ago 2010
5.606
54
48
TN
  • 2 Ott 2012
  • #35
ma non è ancora finita

come diceva Borgo bisogna verificare che non vengano inviati file malevoli

che tipo di file ti aspetti che vengano caricati ? pdf doc immagini ?
 
S

::silver73::

Nuovo Utente
26 Set 2012
19
0
0
  • 2 Ott 2012
  • #36
Per me è già un traguardo essere riusciti fino a questo punto!!! grazie mille dell'aiuto che mi stai dando.

Gli unici file che l'utente dovrebbe poter inviare sono doc o rtf, insomma tutti file di scrittura...
 

criric

Super Moderatore
Membro dello Staff
SUPER MOD
MOD
21 Ago 2010
5.606
54
48
TN
  • 2 Ott 2012
  • #37
Potresti verificare l'estensione del file caricato

crei un array che contiene le estensione che vuoi far passare

PHP:
// estensioni ammesse
    $estensioni = array("doc", "rtf", "txt");
    // se vuoto
    if (empty($_FILES['all']['tmp_name'])) {
        $obbligatorio[] = "File obbligatorio";
    } else {
        //altrimenti verifichiamo l'estensione
        // recuperiamo l'esensione
        $estensionefile = pathinfo($_FILES["all"]["name"], PATHINFO_EXTENSION);
        // se non è nell array
        if (!in_array(strtolower($estensionefile), $estensioni)) {
            $obbligatorio[] = "File non ammesso";
        }
    }

ti riposto tutto il file

PHP:
<?php
// se hanno premuto il pulsante submit 
if (isset($_POST['submit']) && $_POST['submit'] == "submit") {
    // inizializzo campi obbligatori 
    $obbligatorio = array();
    // eliminiamo il post submit  
    unset($_POST['submit']);
    // array ceck obbligatorie 
    $array_check = array("original", "ethicalCode", "copyright", "charge", "peerReview");
    // inizializzo conteggio check 
    $ck = 0;
    // ciclo array ceck obbligatorie 
    foreach ($array_check as $value) {
        // se settata  
        if (isset($_POST[$value])) {
            // incremento 
            $ck++;
        }
    }
    // se non ne trovo neanche una 
    if ($ck < 5) {
        $obbligatorio[] = "Checkbox obbligatorie";
    }
    // se sceglie no  
    if ($_POST['selfCandidature'] == 'no') {
        // lo cancelliamo per non verificarlo  
        unset($_POST['expertise']);
    }
    // ciclo del POST 
    foreach ($_POST as $key => $value) {
        // se non è vuoto 
        if (!empty($value)) {
            // minimo controllo 
            ${$_POST[$key]} = htmlentities($value);
        } else {
            $obbligatorio[] = "\nIl campo $key e' obbligatorio";
        }
    }
    // estensioni ammesse
    $estensioni = array("doc", "rtf", "txt");
    // se vuoto
    if (empty($_FILES['all']['tmp_name'])) {
        $obbligatorio[] = "File obbligatorio";
    } else {
        //altrimenti verifichiamo l'estensione
        // recuperiamo l'esensione
        $estensionefile = pathinfo($_FILES["all"]["name"], PATHINFO_EXTENSION);
        // se non è nell array
        if (!in_array(strtolower($estensionefile), $estensioni)) {
            $obbligatorio[] = "File non ammesso";
        }
    }

    if (count($obbligatorio) == 0) {
        $header = "";
        $msg = "";
        $boundary = '--' . md5(uniqid(time()));
        $ctencoding = "8bit";
        $subject = "Submission of a new Article";
        $testo_del_messaggio = "Title: $title\n";
        $testo_del_messaggio.="Name: $name\n";
        $testo_del_messaggio.="Surname: $surname\n";
        $testo_del_messaggio.="Email: $email\n";
        $testo_del_messaggio.="Telephone: $telephone\n";
        $testo_del_messaggio.="Fax: $fax\n";
        $testo_del_messaggio.="Title of the Article: $titleArticle\n";
        $testo_del_messaggio.="Category: $category\n";
        $testo_del_messaggio.="Originality of the article: $original\n";
        $testo_del_messaggio.="Ethical Code: $ethicalCode\n";
        $testo_del_messaggio.="Rules of the copyright: $copyright\n";
        $testo_del_messaggio.="Rules of the page charge: $charge\n";
        $testo_del_messaggio.="Anonymous peer review: $peerReview\n";
        $testo_del_messaggio.="Self Candidature: $selfCandidature\n";
        $testo_del_messaggio.="Expertise: $expertise\n";
        $to = "daniela.cardillo@gmail.com";
        $from = $_POST['email'];
        $fromname = $_POST['surname'];
        $ctype = "application/octet-stream";
        $basename = $_FILES['all']['tmp_name'];
        $name = $_FILES['all']['name'];
        $header.="From: \"$fromname\" <$from>\nReturn-Path: $from\nX-Priority: 3\nTo: $to\n";
        $header.="Mime-Version: 1.0\nContent-Type: multipart/mixed;  \n boundary=\"$boundary\"\n";
        $header.="Content-Transfer-Encoding: 8bit\n";
        $msg .="This is a multi-part message in MIME format.\n--$boundary\n";
        $msg .= "Content-Type: text/plain; charset=iso-8859-1\n";
        $msg .= "Content-Transfer-Encoding: 8bit\n\n" . $testo_del_messaggio . "\n";
        $msg .="--$boundary\nContent-type: $ctype;\n name=\"$name\"\n";
        $msg .="Content-Transfer-Encoding: base64\nContent-Disposition: attachment\n filename=\"$name\"\n";
        $linesz = filesize($basename) + 1;
        $fp = fopen($basename, 'r');
        $content = chunk_split(base64_encode(fread($fp, $linesz)));
        fclose($fp);
        $msg .= chr(13) . chr(10) . $content;
        $result = @mail($to, $subject, $msg . "\n", $header);
        if ($result) {
            echo "<p>Your data and your article have been successfully sent</p> <p>Thank you very much for your contribution!</p>";
        } else {
            echo " <p>Error.<br>Impossible to send the data.</p><p>Try once again.</p>";
        }
    } else {
        foreach ($obbligatorio as $value) {
            echo $value . "<br/>";
            echo "Torna al form";
        }
    }
} else {
    echo "Post non settato, pagina non accessibile";
}
?>
 
S

::silver73::

Nuovo Utente
26 Set 2012
19
0
0
  • 8 Ott 2012
  • #38
Testato tutto e tutto funziona...scusate l'assenza ma mi si era cimito il pc... :byebye:
 

criric

Super Moderatore
Membro dello Staff
SUPER MOD
MOD
21 Ago 2010
5.606
54
48
TN
  • 8 Ott 2012
  • #39
cimito = rimbambito ?

non ho mai sentito questo aggettivo :book:
 
S

::silver73::

Nuovo Utente
26 Set 2012
19
0
0
  • 8 Ott 2012
  • #40
cimito=bruciato...è andata letteralmente in fumo la ventola
 
Prec.
  • 1
  • 2
  • 3
Succ.
Primo Prec. 2 di 3 Succ. Ultimo
Devi accedere o registrarti per poter rispondere.

Discussioni simili

G
VBA OpenForm con WhereCondition + LIKE su campi differenti
  • Giorgio23
  • 16 Mar 2021
  • MS Access
Risposte
5
Visite
3K
MS Access 15 Apr 2021
CarlettoFed
C
[Javascript] [HTML] Campi form con sfondo imposto dal browser
  • Domenico_Falco1
  • 17 Giu 2019
  • Javascript
Risposte
5
Visite
2K
Javascript 20 Giu 2019
Domenico_Falco1
A
[HTML] form con campi dinamici.
  • arditoma75
  • 24 Ago 2016
  • HTML e CSS
Risposte
1
Visite
2K
HTML e CSS 24 Ago 2016
cris8380
M
Form multipagina con campi già compilati se presenti
  • Maures
  • 7 Gen 2016
  • PHP
Risposte
5
Visite
3K
PHP 8 Gen 2016
borgo italia
E
Form con campi allineamento
  • egalizia
  • 30 Set 2015
  • HTML e CSS
Risposte
4
Visite
4K
HTML e CSS 8 Nov 2015
Jonn
M
Form con campi autocomplete
  • MisterWebMas83
  • 14 Nov 2014
  • Javascript
Risposte
1
Visite
2K
Javascript 18 Nov 2014
criric
Form con campi input text e upload file
  • xone
  • 11 Apr 2014
  • PHP
Risposte
4
Visite
2K
PHP 11 Apr 2014
borgo italia
Form con campi multipli in PHP
  • alessandro1997
  • 27 Mag 2012
  • PHP
Risposte
5
Visite
4K
PHP 11 Gen 2015
hattonfx
H
M
Interazione tra un più campi di un form con un solo campo di database - query mysql
  • megarospo
  • 27 Mag 2008
  • PHP
Risposte
2
Visite
2K
PHP 3 Giu 2008
megarospo
M
P
form con campi dinamici!
  • Pstariell
  • 20 Mar 2008
  • Javascript
Risposte
2
Visite
3K
Javascript 20 Mar 2008
Pstariell
P
Z
Banale invio dati da form con due campi e submit
  • Zorthan
  • 20 Dic 2007
  • PHP
Risposte
3
Visite
3K
PHP 20 Dic 2007
Zorthan
Z
G
FORM con campi dinamici
  • gianpiero82
  • 24 Giu 2007
  • PHP
Risposte
1
Visite
2K
PHP 26 Giu 2007
bruttocattivo
B
Z
[Aiuto] Form con 2 campi collegati
  • Zeroh
  • 17 Set 2006
  • Javascript
Risposte
0
Visite
2K
Javascript 17 Set 2006
Zeroh
Z
S
passare un valore da un form a un file .php con metodo post
  • smack2005
  • 15 Nov 2023
  • PHP
Risposte
4
Visite
1K
PHP 23 Nov 2023
zorro
I
Form con selettore
  • Ikon
  • 2 Dic 2022
  • HTML e CSS
Risposte
0
Visite
935
HTML e CSS 2 Dic 2022
Ikon
I
G
form invio multiplo con checkbox
  • giacomo9783
  • 29 Ott 2022
  • PHP
Risposte
12
Visite
2K
PHP 1 Nov 2022
marino51
R
Aprire maschera con Openform filtrando un campo testuale con un valore recuperato da un'altra maschera
  • RAF66
  • 27 Mar 2022
  • MS Access
Risposte
10
Visite
3K
MS Access 3 Apr 2022
RAF66
R
M
Unire 2 funzioni per l'invio di un form e con l'apertura di un div
  • maxnegri2036
  • 11 Dic 2021
  • Javascript
Risposte
0
Visite
1K
Javascript 11 Dic 2021
maxnegri2036
M
G
Invio form con PHP
  • Giulia2021
  • 24 Lug 2021
  • PHP
Risposte
3
Visite
2K
PHP 17 Ago 2021
bubino8
M
Problema con controllo form in real time
  • migo80
  • 21 Dic 2020
  • jQuery
Risposte
6
Visite
4K
jQuery 30 Dic 2020
migo80
M
Condividi:
Facebook X (Twitter) LinkedIn WhatsApp e-mail Condividi Link
  • Home
  • Forum
  • Fare Web
  • PHP
  • Italiano
  • Termini e condizioni d'uso del sito
  • Policy Privacy
  • Aiuto
  • Home
Community platform by XenForo® © 2010-2024 XenForo Ltd. | Traduzione a cura di XenForo Italia
Menu
Accedi

Registrati

  • Home
  • Forum
    • Nuovi Messaggi
    • Cerca...
  • Novità
    • Featured content
    • Nuovi Messaggi
    • Ultime Attività
X

Privacy & Transparency

We use cookies and similar technologies for the following purposes:

  • Personalized ads and content
  • Content measurement and audience insights

Do you accept cookies and these technologies?

X

Privacy & Transparency

We use cookies and similar technologies for the following purposes:

  • Personalized ads and content
  • Content measurement and audience insights

Do you accept cookies and these technologies?