Jump to content


Photo

mailform


  • Please log in to reply
2 replies to this topic

#1 timmiejboi

timmiejboi

    Newbie

  • New Members
  • Pip
  • 2 posts

Posted 16 August 2014 - 02:10 PM

the sript tells me he send it, without i fill in anything.

and i dont get any mail


testversion : remcogaasenbeek.nl/nieuw
index.html

<form name="form1" method="post" action="verzenden.php">
  <table width="400" border="0">
    <tr>
      <td colspan="2">
       
        </b></td>
    </tr>
    <tr>
      <td width="30%"><font face="Arial" size="2"><font color="#f19028">*</font> Naam</font></td>
      <td width="70%">
        <input type="text" name="naam" size="20">
      </td>
    </tr>
    <tr>
      <td width="30%"><font face="Arial" size="2"><font color="#f19028">*</font> Email</font></td>
      <td width="70%">
        <input type="text" name="email" size="20">
      </td>
    </tr>
     <tr>
      <td width="30%"><font face="Arial" size="2"><font color="#f19028">*</font> Telefoonnummer</font></td>
      <td width="70%">
        <input type="text" name="telefoonnummer" size="20">
      </td>
    </tr>
 <tr>
      <td width="30%"><font face="Arial" size="2"><font color="#f19028">*</font> Woonplaats</font></td>
      <td width="70%">
        <input type="text" name="woonplaats" size="20">
      </td>
    </tr>
    </tr>
    <tr>
      <td colspan="2">
        <font face="Arial" size="2"><br>
        <input type="submit" name="submit" value="Verstuur">
        </font>
        </td>
    </tr>
  </table>
</form>
<font color="#f19028">*</font> <font size="1"> De proefles is gratis indien men besluit om een rijopleiding <BR>bij rijschool Remco Gaaseneek te nemen. anders blijft het een vrijblijvende les van €25,-.</font>

<?php
if (!isset($_POST['naam']) || !isset($_POST['email']) || !isset($_POST['telefoonnummer'])) {
    echo 'U heeft niet alle velden ingevuld!';
    exit;
}
 
$naam = htmlspecialchars($_POST['naam']);
$email = htmlspecialchars($_POST['email']);
$telefoonnummer = htmlspecialchars($_POST['telefoonnummer']);
$woonplaats= htmlspecialchars($_POST['woonplaats']);
 
$tijd = time();
$datum = strftime('%d/%m/%y %H:%M', $tijd);
$ip = getenv('REMOTE_ADDR');
$message = $naam.' met het e-mailadres '.$email.' en het IP '.$ip.' stuurde op '.$datum.' het volgende nummer en woonplaats:
____________________________________
'.$telefoonnummer.' 
'.$woonplaats.'
------------------------------------';
 
mail('timiejboi@gmail.com', 'proefles', $message, 'From: '.$email);                                 
echo 'Uw bericht is verzonden. U krijgt zo snel mogelijk antwoord.';
?>

i hope u guys can help me out.

 

cheers,

timmiejboi

 



#2 mac_gyver

mac_gyver

    Advanced Member

  • Administrators
  • 2,568 posts

Posted 17 August 2014 - 11:17 AM

text textarea, and password form fields will be set, even if they are empty.

 

your form processing logic should first test if your form was submitted, then specifically test the content from each form field. for fields that are required, at a minimum, you would want to test if their character length is greater than an acceptable minimum.


multi-purpose programming fool. well written source-code should be self-documenting. well written code should be self-troubleshooting. 


#3 BuildMyWeb

BuildMyWeb

    Advanced Member

  • Members
  • PipPipPip
  • 111 posts
  • LocationNY

Posted 20 August 2014 - 03:33 PM

use

empty()
instead of
!isset()

Freelance Web Developer | Web Hosting | PHP Applications
Web Development, Hosting, Graphic Design, SEO





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

Cheap Linux VPS from $5
SSD Storage, 30 day Guarantee
1 TB of BW, 100% Network Uptime

AlphaBit.com