codice HTML:
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Forum di prova</title>
</head>
<body>
<form action="" method="post">
<fieldset style="margin:2px; padding:2px; background:#099; float:right; width:49%; height:500px;">
<legend style="margin:2px; padding:2px; background:#0C0;"><strong>Legali</strong></legend>
<p><strong>Attenzione:</strong> si prega di prendere visioni delle note legali e delle note riguardanti la gestione dei dati personali prima di inviare i dati.</p>
<label>Accetta le condizioni
<input name="privacy" type="checkbox" value="accetta">
</label>
<input name="Invio" type="submit" value="invio">
</fieldset>
<fieldset style="margin:2px; padding:2px; background:#099; float:left; width:49%; height:500px;">
<legend style="margin:2px; padding:2px; background:#0C0;"><strong>Dati personali</strong></legend>
<table>
<tr>
<td width="200"><label>Nome *</label></td>
<td><input name="nome" type="text"></td>
</tr>
<tr>
<td><label>Cognome</label></td>
<td><input name="cognome" type="text"></td>
</tr>
<tr>
<td><label>Azienda *</label></td>
<td><input name="azienda" type="text"></td>
</tr>
<tr>
<td><label>Cittá</label></td>
<td><input name="citta" type="text"></td>
</tr>
<tr>
<td><label>Email *</label></td>
<td><input name="email" type="text"></td>
</tr>
<tr>
<td colspan="2"><label>Scrivi qui il tuo messaggio *</label></td>
</tr>
<tr>
<td colspan="2"><textarea name="messaggio" cols="50" rows="8"></textarea></td>
</tr>
</table>
<p>* Campi obbligatori</p>
</fieldset>
</form>
</body>
</html>
Codice PHP:
<?php
ini_set('display_error', '0');
error_reporting (0);
$nome=$_POST['nome'];
$cognome=$_POST['cognome'];
$azienda=$_POST['azienda'];
$citta=$_POST['citta'];
$mail=$_POST['email'];
$messaggio=$_POST['messaggio'];
$condizioni=$_POST['privacy'];
$destinatario="nazzag84@gmail.com";
$oggetto="Mail da sito internet";
if($nome!="" && $azienda!="" && $mail!="" && $messaggio!="")
{if ($condizioni=="accetta")
{
$body="<strong>Nome: <strong>" . $nome . "\n";
$body.="<strong>Cognome: <strong>" . $cognome . "\n";
$body.="<strong>Azienda: <strong>" . $azienda . "\n";
$body.="<strong>Cittá: <strong>" . $citta . "\n";
$body.="<strong>Mail: <strong>" . $mail . "\n";
$body.="<strong>Messaggio: <strong>" . $messaggio . "\n";
mail($destinatario,$oggetto,$body);
echo '<p style="font-size:20px;"><strong>Qui voglio creare una finestra dialogo (ho provato senza risultato con Jquery modale)con una immagine e il messaggio GRAZIE PER AVERCI CONTATTATO</strong></p>';
}
elseif ($condizioni=="")
{
echo '<p style="font-size:20px;"><strong>Qui voglio creare una finestra di dialogo (ho provato senza risultato con Jquery modale) con una immagine e il messaggio ACCETTARE LE CONDIZIONI DI UTILIZZO DEL SITO</strong></p>';
}
}
else {echo '<p style="font-size:20px;"><strong>Qui voglio creare una finestra di dialogo (ho provato senza risultato con Jqueri modale) con la stessa immagine precedente e il messaggio SI PREGA DI COMPILARE TUTTI I CAMPI OBBLIGATORI</strong></p>';
}
?>
Ho tolto i commenti, spero che così possa essere meglio