[PHP] [HTML] form contatti

Angelo Russo

Nuovo Utente
8 Mag 2018
23
0
1
47
buongiorno,
dovrei inserire un form contatti nel mio sito.
ho seguito le indicazioni così come nel sito MrWebmaster, ho inserito il file php, ma non mi funziona.

questo il file php:

PHP:
<html>
<head>
<meta charset="utf-8">
<title>formmail</title>
</head>

<body>
<pre>&lt;<?php
$miamail = "[email protected]";
$successo = $_POST['successo'];
$nome = $_POST['nome'];
$email = $_POST['email'];
$msg = $_POST['msg'];
$messaggio = "Nome: " . $nome . "\nEmail: " . $email .  "\nMessaggio: " . $msg;
$headers = "From: " . $miamail . "\r\n" . "Reply-To: " . $miamail;
mail($miamail,"Messaggio dal sito",$messaggio,$headers);
header("location: " . $successo);
?>&gt;</pre>
</body>
</html>

questo invece l'html:

HTML:
<html>
<head>
<meta charset="utf-8">
<title>ARGrafica</title>
<style type="text/css">
body {
    background-color: #b3c5ff;
    <button
    color: #black;
    background-color: #b3c5ff;


    align-content: center;
    position: relative;
    text-align: left;
    text-decoration: none;
    display: block;
    font-size: 20px;>
            </button>
}
body table tbody tr td p {
    font-family: Lucida Grande, Lucida Sans Unicode, Lucida Sans, DejaVu Sans, Verdana, sans-serif;
}
</style>
<link href="Senzatitolo-1.css" rel="stylesheet" type="text/css">
</head>

<body>
<table width="1024" border="0" align="center" cellpadding="0" cellspacing="0">
  <tbody>
    <tr>
      <td colspan="4"><img src="testata.jpg" width="1024" height="138" alt=""/></td>
    </tr>
    <tr>
        <td width="282" height="56"   align="center">&nbsp;  <a href="index.html"  class="button" /a><a href="index.html"><img src="bottone_home.jpg" alt="" width="233" height="50" align="top"/></a></td>
      <td width="546" align="justify" rowspan="6"><p>
        <label for="nome">Nome e Cognome</label>
          <input type="text" id="nome" name="nome" placeholder="Inserisci Nome e Cognome">
        <form name="formmail" method="post" action="formmail.php" onsubmit="return controlloForm()">
        <script> function verificaEmail(email) {
  var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
  return re.test(email);
}

function controlloForm() {
  var nome = document.forms["formmail"]["nome"].value;
  var email = document.forms["formmail"]["email"].value;
  var tel = document.forms["formmail"]["tel"].value;
  var msg = document.forms["formmail"]["msg"].value;

  if (nome == "" || email == "" || msg == "") {
    alert("I campi Nome, Email e Messaggio sono obbligatori!");
    return false;
  }
  else if (verificaEmail(email) !== true) {
    alert("L'indirizzo email non sembra corretto!");
    return false; 
  }else{
    return true;
  }
}
</script>
        <p>
            <label for="email">Email</label>
              <input type="text" id="email" name="email" placeholder="Indirizzo di posta elettronica">
        </p>
        <p>
          
          
          <label for="msg">              Messaggio</label>
          <textarea id="msg" name="msg" placeholder="Scrivi il tuo messaggio"></textarea>
          <input type="submit" value="Invia Richiesta">
          </p>
            

      </form>&nbsp;</p></td>
        
        
      <td width="91" rowspan="0">&nbsp;</td>
      <td width="105">&nbsp;</td>      <td width="5">&nbsp;</td>
      <td width="5">&nbsp;</td>
    </tr>
    <tr>
        <td height="55"  align="center">&nbsp;  <a href="ARGrafica_siti web.html"; class="button" /a><a href="ARGrafica_siti web.html"><img src="bottone_sw.jpg" width="233" height="50" alt=""/></a></td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
    <tr>
            <td height="55"   align="center">&nbsp;  <a href="ARGrafica_grafiche.html"  class="button" /a><a href="ARGrafica_grafiche.html"><img src="bottone_grafiche.jpg" width="233" height="50" alt=""/></a></td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
    <tr>
        <td height="55"  align="center">&nbsp;  <a href=""  class="button" /a>
            <a href="ARGrafica_artworks.html"><img src="bottone_aw.jpg"; background-color="#b3c5ff" alt=""></a></td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
    <tr>
                <td  height="55" align="center">&nbsp;  <a href=""  class="button" /a><img src="bottone_contatti_over.jpg" width="233" height="50" alt=""/></td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td height="22">&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td colspan="4" align="center"><p>&nbsp;</p>
      <p>&nbsp;</p></td>
    </tr>
  </tbody>
</table>
</body>
</html>

com'è che non funziona?????
 
Discussioni simili
Autore Titolo Forum Risposte Data
M Collegamento tra form html e script php PHP 4
C Form email php su pagina index.html? PHP 21
webmachine [PHP] [JAVASCRIPT] Form strano in HTML PHP PHP 1
F [PHP] Form html PHP 2
G FORM HTML E PHP PHP 0
ANDREA20 [PHP] [HTML] crea form di contatto PHP 4
F [PHP] [HTML] File legato ad action in un form PHP 1
andreas88 [PHP] [HTML] Pagina preventivi form contatti PHP 5
J [PHP] [HTML] Trasferire dati da un form ad un dominio diverso. PHP 3
trattorino [PHP] [HTML] problema form PHP 1
S Html con form e action .php PHP 6
F Interazione tra i form html ajax e php PHP 3
S Problema invio form php/html PHP 3
manugonn [PHP] [HTML] SCRITTURA SU FILE TXT DA FORM PHP 11
giuseppe_123 Problemi form php/html PHP 33
Fuego2806 [PHP] Stampare dati Form su immagine di sfondo con html PHP 70
C E' possibile assegnare all' attributo name di un form html il nome di una variabile php? PHP 6
R form html e php nella stessa pagina PHP 4
S Form invio mail html, con invio tramite file denominato invio.php PHP 8
E Correzione per form PHP/HTML PHP 3
S inviare the_title() in una mail tramite form html/php PHP 0
M Form html-php, la pagina php non mi rileva la variabile PHP 5
L come passare il campo allegato dal file html al fiel php per spedirlo con un form PHP 12
A form in php o html per raccolta mail PHP 4
unkus_nob valori checkbox di form html in file php senza submit PHP 1
D invocare metodo oggetto php da form html PHP 0
S HTML-PHP Form grandezza varibile HTML e CSS 6
neo996sps Form HTML e PHP PHP 1
L Ricezione dei dati su file php da modulo html PHP 6
C Dopo chiusura del tag php la stringa html va a capo PHP 1
A inserire variabile php colore in div html PHP 2
E Errore di lettura php in html PHP 8
M HTML e PHP Offerte e Richieste di Lavoro e/o Collaborazione 3
Z Mod_rewrite da HTML in PHP PHP 3
C [RISOLTO]Inserimento variabile php in input html PHP 20
C Risalire al php da html PHP 27
F [PHP] [HTML] Tabella cambia pagina responsive PHP 8
M [PHP] [HTML] Centrare in verticale un pulsante in una tabella PHP 3
M [PHP] Istruzione "echo" all'interno di codice html PHP 2
F [PHP] Importare file CSV in HTML PHP 12
T [PHP] [HTML] Dettagli che cambiano PHP 5
M [PHP] Come inserire codice html in un ciclo while PHP 2
T con oop creare un ciclo per una pagina dinamica html con php PHP 3
F [PHP] [HTML] Formmail PHP 0
D [PHP] [HTML] Pagina con permessi amministratore PHP 6
L [Wordpress]Precedenza Index.php a Index.html WordPress 1
F [PHP] Importare file CSV in HTML PHP 3
C [PHP] Pagina html che legge file txt PHP 41
GiErre [PHP] [HTML] Disabilitare un link in funzione della piattaforma PHP 7
Y [PHP] [HTML] Modificare i quadranti PHP 1

Discussioni simili