[PHP] [HTML] form contatti

Angelo Russo

Nuovo Utente
8 Mag 2018
23
0
1
48
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 = "angelorusso01234@gmail.com";
$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