Jump to content

PHP mail form


Ron@ld
 Share

Recommended Posts

Ik heb net ff geprobeerd een PHP mail formuliertje te maken maar is mij nog niet helemaal goed gelukt.
Ik wil controleren of ze alles hebben ingevuld maar dat werkt niet goed als ze niks invullen dan mail hij hem wel.

Er moet ook komen te staan dat de email is gestuurd hoe doe ik dat?

Hieronder de code:

[code]<?php
if (isset($_POST['verzenden'])) { Edited by PC-fre@k
Link to comment
Share on other sites

dat is een goed idee ;)

[code]<?php
if (isset($_POST['verzenden'])) {
   $error = '';
   if (empty($_POST['email']) || empty($_POST['email'])) {
       $error .= "Geen geldig e-mail adres ingevuld<BR />";
   } if (empty($_POST['naam']) || empty($_POST['naam'])) {
       $error .= "Naam is niet ingevuld<BR />";
   } if (empty($_POST['bericht']) || empty($_POST['bericht'])) {
       $error .= "U heeft geen bericht ingevuld<BR />";
   }
   
   if (empty($error)) {
   
    $bericht = "Naam  : " .$_POST['naam']. "
   
E-mail  : ".$_POST['email']. "

Bericht : ".$_POST['bericht']. " \n";
 mail ("**@gmail.com", "Bericht van je website", $bericht, "FROM: Je website");
 echo "De e-mail is verstuurd";
} else {
 echo "Gelieve alle velden netjes in te vullen!";
 
   }
   
} else {

   echo "<FONT COLOR=\"#FF0000\">".$error."</FONT>";
}

?>

<html>

<head>
 <meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
 <meta name="copyright" content="Ronald van Butselaar ">
 <title>Michiel van Butselaar</title>
 <link href="midden.css" rel="stylesheet" type="text/css" media="all">
 <script type="text/javascript">
 window.status="Michiel van Butselaar"</script>
</head>

<body bgcolor="#ffffff" leftmargin="0" marginheight="0" marginwidth="0" topmargin="0">
 <p></p>
 <p>E-mail Michiel</p>
 <form id="mailForm" method="post" name="mailForm">
  <table border="0" cellspacing="0" cellpadding="0">
   <tr>
    <td width="130">E-mail:</td>
    <td width="303"><input type="text" name="email" value="Vul hier uw e-mail adres in." size="24" maxlength="50"></td>
   </tr>
   <tr>
    <td width="130">Naam:</td>
    <td width="303"><input type="text" name="naam" value="Vul hier uw naam in." size="24" maxlength="50"></td>
   </tr>
   <tr>
    <td valign="top" width="130">Bericht:</td>
    <td width="303"><textarea name="bericht" rows="5" cols="40">Type hier het bericht.</textarea></td>
   </tr>
   <tr>
    <td width="130"></td>
    <td width="303"><input type="submit" name="verzenden" value="Verzenden"> <input type="reset" value="Wissen"></td>
   </tr>
  </table>
 </form>
 <p></p>
</body>

</html>[/code]
Link to comment
Share on other sites

nou niet datk m ga gebruiken ofzo, maar da ken k makkelijker zien wat er anders aan is :)
ah kziet t al
extra regel in de head om t script aan te roepen, toch? Edited by Krop
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...